org.springframework.integration.ip.tcp
Class AbstractTcpReceivingChannelAdapter

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
All Implemented Interfaces:
java.lang.Runnable, 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, MessageProducer, CommonSocketOptions, ComponentMetadataProvider
Direct Known Subclasses:
TcpNetReceivingChannelAdapter, TcpNioReceivingChannelAdapter

public abstract class AbstractTcpReceivingChannelAdapter
extends AbstractInternetProtocolReceivingChannelAdapter

Abstract class for tcp/ip incoming channel adapters. Implementations for Socket and SocketChannel are provided.

Author:
Gary Russell

Field Summary
protected  SocketMessageMapper mapper
           
protected  int messageFormat
           
protected  int poolSize
           
protected  boolean soKeepAlive
           
protected  org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler threadPoolTaskScheduler
           
 
Fields inherited from class org.springframework.integration.ip.AbstractInternetProtocolReceivingChannelAdapter
active, port, receiveBufferSize, soReceiveBufferSize, soTimeout
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Constructor Summary
AbstractTcpReceivingChannelAdapter(int port)
          Constructs a receiving channel adapter that listens on the port.
 
Method Summary
 void run()
          Creates the ThreadPoolTaskScheduler, if necessary, and calls server().
protected abstract  void server()
          Establishes the server.
 void setMessageFormat(int messageFormat)
           
 void setPoolSize(int poolSize)
           
protected  void setSocketOptions(java.net.Socket socket)
          Sets soTimeout, soKeepAlive and tcpNoDelay according to the configured properties.
 void setSoKeepAlive(boolean soKeepAlive)
           
 
Methods inherited from class org.springframework.integration.ip.AbstractInternetProtocolReceivingChannelAdapter
doStart, doStop, getPort, setReceiveBufferSize, setSoReceiveBufferSize, setSoSendBufferSize, setSoTimeout
 
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, getBeanName, getChannelResolver, getComponentMetadata, getConversionService, getTaskScheduler, populateComponentMetadata, setBeanFactory, setBeanName, setChannelResolver, setConversionService, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

threadPoolTaskScheduler

protected volatile org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler threadPoolTaskScheduler

poolSize

protected volatile int poolSize

mapper

protected volatile SocketMessageMapper mapper

soKeepAlive

protected volatile boolean soKeepAlive

messageFormat

protected int messageFormat
Constructor Detail

AbstractTcpReceivingChannelAdapter

public AbstractTcpReceivingChannelAdapter(int port)
Constructs a receiving channel adapter that listens on the port.

Parameters:
port - The port to listen on.
Method Detail

run

public void run()
Creates the ThreadPoolTaskScheduler, if necessary, and calls server().


server

protected abstract void server()
Establishes the server.


setSocketOptions

protected void setSocketOptions(java.net.Socket socket)
                         throws java.net.SocketException
Sets soTimeout, soKeepAlive and tcpNoDelay according to the configured properties.

Parameters:
socket - The socket.
Throws:
java.net.SocketException

setSoKeepAlive

public void setSoKeepAlive(boolean soKeepAlive)
Parameters:
soKeepAlive - the soKeepAlive to set
See Also:
Socket#setKeepAlive(boolean)}.

setMessageFormat

public void setMessageFormat(int messageFormat)
Parameters:
messageFormat - the messageFormat to set

setPoolSize

public void setPoolSize(int poolSize)
Parameters:
poolSize - the poolSize to set