Spring Integration

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:
Runnable, BeanFactoryAware, BeanNameAware, InitializingBean, Lifecycle, Phased, SmartLifecycle, MessageProducer, NamedComponent, CommonSocketOptions
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.

Since:
2.0
Author:
Gary Russell

Field Summary
protected  boolean close
           
protected  SocketMessageMapper mapper
           
protected  int messageFormat
           
protected  boolean 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
AbstractTcpReceivingChannelAdapter(int port)
          Constructs a receiving channel adapter that listens on the port.
 
Method Summary
 void run()
          Checks that we have a task executor and calls server().
protected abstract  void server()
          Establishes the server.
 void setClose(boolean close)
           
 void setMessageFormat(int messageFormat)
           
protected  void setSocketOptions(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
checkTaskExecutor, doStart, doStop, 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

mapper

protected volatile SocketMessageMapper mapper

soKeepAlive

protected volatile boolean soKeepAlive

messageFormat

protected volatile int messageFormat

close

protected volatile boolean close
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()
Checks that we have a task executor and calls server().


server

protected abstract void server()
Establishes the server.


setSocketOptions

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

Parameters:
socket - The socket.
Throws:
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
See Also:
MessageFormats

setClose

public void setClose(boolean close)
Parameters:
close - the close to set

Spring Integration

Copyright © 2010. All Rights Reserved.