Spring Integration

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, 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 TcpNioConnections.

Since:
2.0
Author:
Gary Russell

Field Summary
 
Fields inherited from class org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
DEFAULT_REPLY_TIMEOUT, lifecycleMonitor
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
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.
protected  java.util.Map<java.nio.channels.SocketChannel,TcpNioConnection> getConnections()
           
protected  java.util.concurrent.BlockingQueue<java.nio.channels.SocketChannel> getNewChannels()
           
protected  boolean isUsingDirectBuffers()
           
protected  TcpConnection obtainConnection()
           
 void run()
           
 void setTcpNioConnectionSupport(TcpNioConnectionSupport tcpNioSupport)
           
 void setUsingDirectBuffers(boolean usingDirectBuffers)
          When set to true, connections created by this factory attempt to use direct buffers where possible.
 void start()
           
 
Methods inherited from class org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory
forceClose, getConnection, 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, 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
 

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

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

Spring Integration