org.springframework.integration.ip.tcp.connection
Class TcpNioClientConnectionFactory
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory
org.springframework.integration.ip.tcp.connection.TcpNioClientConnectionFactory
- All Implemented Interfaces:
- java.lang.Runnable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, NamedComponent, ConnectionFactory
public class TcpNioClientConnectionFactory
- extends AbstractClientConnectionFactory
- implements java.lang.Runnable
A client connection factory that creates TcpNioConnection
s.
- Since:
- 2.0
- Author:
- Gary Russell
Constructor Summary |
TcpNioClientConnectionFactory(java.lang.String host,
int port)
Creates a TcpNioClientConnectionFactory for connections to the host and port. |
Methods inherited from class org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory |
addConnection, checkActive, doAccept, getDeserializer, getHost, getListener, getMapper, getPhase, getPoolSize, getPort, getSender, getSerializer, getSoLinger, getSoReceiveBufferSize, getSoSendBufferSize, getSoTimeout, getSoTrafficClass, getTaskExecutor, getTcpSocketSupport, harvestClosedConnections, isActive, isAutoStartup, isLookupHost, isRunning, isSingleUse, isSoKeepAlive, isSoTcpNoDelay, processNioSelections, registerListener, registerSender, setActive, setDeserializer, setInterceptorFactoryChain, setLookupHost, setMapper, setNioHarvestInterval, setPoolSize, setSerializer, setSingleUse, setSocketAttributes, setSoKeepAlive, setSoLinger, setSoReceiveBufferSize, setSoSendBufferSize, setSoTcpNoDelay, setSoTimeout, setSoTrafficClass, setTaskExecutor, setTcpSocketSupport, stop, stop, wrapConnection |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, getBeanFactory, getComponentName, getComponentType, getConversionService, getTaskScheduler, onInit, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
TcpNioClientConnectionFactory
public TcpNioClientConnectionFactory(java.lang.String host,
int port)
- Creates a TcpNioClientConnectionFactory for connections to the host and port.
- Parameters:
host
- the hostport
- the port
obtainConnection
protected TcpConnection obtainConnection()
throws java.lang.Exception
- Specified by:
obtainConnection
in class AbstractClientConnectionFactory
- Throws:
java.lang.Exception
java.io.IOException
java.net.SocketException
setUsingDirectBuffers
public void setUsingDirectBuffers(boolean usingDirectBuffers)
- When set to true, connections created by this factory attempt
to use direct buffers where possible.
- Parameters:
usingDirectBuffers
- - See Also:
ByteBuffer
setTcpNioConnectionSupport
public void setTcpNioConnectionSupport(TcpNioConnectionSupport tcpNioSupport)
close
public void close()
- Description copied from class:
AbstractConnectionFactory
- Closes the server.
- Specified by:
close
in class AbstractConnectionFactory
start
public void start()
- Specified by:
start
in interface org.springframework.context.Lifecycle
- Overrides:
start
in class AbstractConnectionFactory
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
isUsingDirectBuffers
protected boolean isUsingDirectBuffers()
- Returns:
- the usingDirectBuffers
getConnections
protected java.util.Map<java.nio.channels.SocketChannel,TcpNioConnection> getConnections()
- Returns:
- the connections
getNewChannels
protected java.util.concurrent.BlockingQueue<java.nio.channels.SocketChannel> getNewChannels()
- Returns:
- the newChannels