Spring Integration

org.springframework.integration.ip.tcp
Class TcpNioReceivingChannelAdapter

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.endpoint.AbstractEndpoint
          extended by org.springframework.integration.endpoint.MessageProducerSupport
              extended by org.springframework.integration.ip.AbstractInternetProtocolReceivingChannelAdapter
                  extended by org.springframework.integration.ip.tcp.AbstractTcpReceivingChannelAdapter
                      extended by org.springframework.integration.ip.tcp.TcpNioReceivingChannelAdapter
All Implemented Interfaces:
Runnable, BeanFactoryAware, BeanNameAware, InitializingBean, Lifecycle, Phased, SmartLifecycle, MessageProducer, NamedComponent, CommonSocketOptions

public class TcpNioReceivingChannelAdapter
extends AbstractTcpReceivingChannelAdapter

Tcp Receiving Channel adapter that uses a SocketChannel. Sockets are multiplexed across the pooled threads. More than one thread will be required with large numbers of connections and incoming traffic. The number of threads is controlled by the poolSize property.

Since:
2.0
Author:
Gary Russell

Field Summary
protected  Class<NioSocketReader> customSocketReaderClass
           
protected  ServerSocketChannel serverChannel
           
protected  boolean usingDirectBuffers
           
 
Fields inherited from class org.springframework.integration.ip.tcp.AbstractTcpReceivingChannelAdapter
close, mapper, messageFormat, soKeepAlive
 
Fields inherited from class org.springframework.integration.ip.AbstractInternetProtocolReceivingChannelAdapter
active, listening, localAddress, poolSize, port, receiveBufferSize, soReceiveBufferSize, soTimeout, taskExecutor
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Constructor Summary
TcpNioReceivingChannelAdapter(int port)
          Constructs a TcpNioReceivingChannelAdapter to listen on the port.
 
Method Summary
protected  void doStop()
          Subclasses must implement this method with the stop behavior.
protected  void server()
          Opens a non-blocking ServerSocketChannel, registers it with a Selector and calls doSelect(ServerSocketChannel, Selector).
 void setCustomSocketReaderClassName(String customSocketReaderClassName)
           
 void setUsingDirectBuffers(boolean usingDirectBuffers)
           
 
Methods inherited from class org.springframework.integration.ip.tcp.AbstractTcpReceivingChannelAdapter
run, setClose, setMessageFormat, setSocketOptions, setSoKeepAlive
 
Methods inherited from class org.springframework.integration.ip.AbstractInternetProtocolReceivingChannelAdapter
checkTaskExecutor, doStart, getLocalAddress, getPort, isListening, setLocalAddress, setPoolSize, setReceiveBufferSize, setSoReceiveBufferSize, setSoSendBufferSize, setSoTimeout, setTaskExecutor
 
Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupport
onInit, sendMessage, setOutputChannel, setSendTimeout
 
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
getPhase, isAutoStartup, isRunning, setAutoStartup, setPhase, setTaskScheduler, start, stop, stop
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getChannelResolver, getComponentName, getComponentType, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, toString, writeMessageHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serverChannel

protected ServerSocketChannel serverChannel

usingDirectBuffers

protected boolean usingDirectBuffers

customSocketReaderClass

protected Class<NioSocketReader> customSocketReaderClass
Constructor Detail

TcpNioReceivingChannelAdapter

public TcpNioReceivingChannelAdapter(int port)
Constructs a TcpNioReceivingChannelAdapter to listen on the port.

Parameters:
port - The port.
Method Detail

server

protected void server()
Opens a non-blocking ServerSocketChannel, registers it with a Selector and calls doSelect(ServerSocketChannel, Selector).

Specified by:
server in class AbstractTcpReceivingChannelAdapter
See Also:
AbstractTcpReceivingChannelAdapter.server()

doStop

protected void doStop()
Description copied from class: AbstractEndpoint
Subclasses must implement this method with the stop behavior. This method will be invoked while holding the AbstractEndpoint.lifecycleLock.

Overrides:
doStop in class AbstractInternetProtocolReceivingChannelAdapter

setUsingDirectBuffers

public void setUsingDirectBuffers(boolean usingDirectBuffers)
Parameters:
usingDirectBuffers - Set true if you wish to use direct buffers for NIO operations.

setCustomSocketReaderClassName

public void setCustomSocketReaderClassName(String customSocketReaderClassName)
                                    throws ClassNotFoundException
Parameters:
customSocketReaderClassName - the customSocketReaderClassName to set
Throws:
ClassNotFoundException

Spring Integration

Copyright © 2010. All Rights Reserved.