org.springframework.integration.ip.tcp.connection
Class TcpNioClientConnectionFactory
java.lang.Object
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, Lifecycle , Phased , SmartLifecycle , ConnectionFactory
public class TcpNioClientConnectionFactory extends AbstractClientConnectionFactory
A client connection factory that creates TcpNioConnection
s.
Since:
2.0
Fields inherited from class org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
active , DEFAULT_REPLY_TIMEOUT , deserializer , host , interceptorFactoryChain , listener , logger , mapper , poolSize , port , sender , serializer , singleUse , soTimeout , taskExecutor
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
getHost , getPhase , getPort , getSoLinger , getSoReceiveBufferSize , getSoSendBufferSize , getSoTimeout , getSoTrafficClass , isAutoStartup , isSingleUse , isSoKeepAlive , isSoTcpNoDelay , registerListener , registerSender , setDeserializer , setInterceptorFactoryChain , setMapper , setPoolSize , setSerializer , setSingleUse , setSocketAttributes , setSoKeepAlive , setSoLinger , setSoReceiveBufferSize , setSoSendBufferSize , setSoTcpNoDelay , setSoTimeout , setSoTrafficClass , setTaskExecutor , start , stop , stop , wrapConnection
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
usingDirectBuffers
protected boolean usingDirectBuffers
connections
protected java.util.Map<java.nio.channels.SocketChannel,TcpNioConnection > connections
newChannels
protected java.util.concurrent.BlockingQueue<java.nio.channels.SocketChannel> newChannels
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
getConnection
public TcpConnection getConnection ()
throws java.lang.Exception
Obtains a connection - if AbstractConnectionFactory.setSingleUse(boolean)
was called with
true, a new connection is returned; otherwise a single connection is
reused for all requests while the connection remains open.
Throws:
java.lang.Exception
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
close
public void close ()
Description copied from class: AbstractConnectionFactory
Closes the server.
Specified by: close
in class AbstractConnectionFactory
run
public void run ()
isRunning
public boolean isRunning ()