org.springframework.integration.ip.tcp.connection
Class TcpNioClientConnectionFactory

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
          extended by org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory
              extended by org.springframework.integration.ip.tcp.connection.TcpNioClientConnectionFactory
All Implemented Interfaces:
java.lang.Runnable, BeanFactoryAware, BeanNameAware, InitializingBean, Lifecycle, Phased, SmartLifecycle, NamedComponent, ConnectionFactory

public class TcpNioClientConnectionFactory
extends AbstractClientConnectionFactory

A client connection factory that creates TcpNioConnections.

Since:
2.0

Field Summary
 
Fields inherited from class org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
DEFAULT_REPLY_TIMEOUT, lifecycleMonitor, logger
 
Constructor Summary
TcpNioClientConnectionFactory(java.lang.String host, int port)
          Creates a TcpNioClientConnectionFactory for connections to the host and port.
 
Method Summary
 void close()
          Closes the server.
 TcpConnection getConnection()
          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.
protected  java.util.Map<java.nio.channels.SocketChannel,TcpNioConnection> getConnections()
           
protected  java.util.concurrent.BlockingQueue<java.nio.channels.SocketChannel> getNewChannels()
           
protected  boolean isUsingDirectBuffers()
           
 void run()
           
 void setUsingDirectBuffers(boolean usingDirectBuffers)
          When set to true, connections created by this factory attempt to use direct buffers where possible.
 
Methods inherited from class org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory
getTheConnection, initializeConnection, setTheConnection
 
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, harvestClosedConnections, isActive, isAutoStartup, isLookupHost, isRunning, isSingleUse, isSoKeepAlive, isSoTcpNoDelay, processNioSelections, registerListener, registerSender, setActive, setDeserializer, setInterceptorFactoryChain, setLookupHost, setMapper, setPoolSize, setSerializer, setSingleUse, setSocketAttributes, setSoKeepAlive, setSoLinger, setSoReceiveBufferSize, setSoSendBufferSize, setSoTcpNoDelay, setSoTimeout, setSoTrafficClass, setTaskExecutor, start, 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
 
Methods inherited from interface org.springframework.beans.factory.BeanNameAware
setBeanName
 

Constructor Detail

TcpNioClientConnectionFactory

public TcpNioClientConnectionFactory(java.lang.String host,
                                     int port)
Creates a TcpNioClientConnectionFactory for connections to the host and port.

Parameters:
host - the host
port - the port
Method Detail

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()

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