Spring Integration

org.springframework.integration.ip.tcp
Class TcpNetSendingMessageHandler

java.lang.Object
  extended by org.springframework.integration.ip.AbstractInternetProtocolSendingMessageHandler
      extended by org.springframework.integration.ip.tcp.AbstractTcpSendingMessageHandler
          extended by org.springframework.integration.ip.tcp.TcpNetSendingMessageHandler
All Implemented Interfaces:
MessageHandler, CommonSocketOptions

public class TcpNetSendingMessageHandler
extends AbstractTcpSendingMessageHandler

TCP Sending Channel Adapter that that uses a Socket.

Since:
2.0
Author:
Gary Russell

Field Summary
protected  Class<NetSocketWriter> customSocketWriterClass
           
protected  Socket socket
           
 
Fields inherited from class org.springframework.integration.ip.tcp.AbstractTcpSendingMessageHandler
mapper, messageFormat, soKeepAlive, soLinger, soTcpNoDelay, soTrafficClass, writer
 
Fields inherited from class org.springframework.integration.ip.AbstractInternetProtocolSendingMessageHandler
destinationAddress, host, logger, port, soSendBufferSize, soTimeout
 
Constructor Summary
TcpNetSendingMessageHandler(String host, int port)
          Constructs a TcpNetSendingMessageHandler that sends data to the specified host and port.
 
Method Summary
protected  void close()
          Close the underlying socket and prepare to establish a new socket on the next write.
protected  Socket getSocket()
           
protected  SocketWriter getWriter()
          Returns the socket writer after instantiating it, if necessary.
 void setCustomSocketWriterClassName(String customSocketWriterClassName)
           
 void setLocalAddress(String localAddress)
          On a multi-homed system, specifies the ip address of the network interface used to communicate.
 
Methods inherited from class org.springframework.integration.ip.tcp.AbstractTcpSendingMessageHandler
doWrite, handleMessage, setMessageFormat, setSocketAttributes, setSoKeepAlive, setSoLinger, setSoTcpNoDelay, setSoTrafficClass
 
Methods inherited from class org.springframework.integration.ip.AbstractInternetProtocolSendingMessageHandler
getPort, setSoReceiveBufferSize, setSoSendBufferSize, setSoTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

customSocketWriterClass

protected Class<NetSocketWriter> customSocketWriterClass

socket

protected volatile Socket socket
Constructor Detail

TcpNetSendingMessageHandler

public TcpNetSendingMessageHandler(String host,
                                   int port)
Constructs a TcpNetSendingMessageHandler that sends data to the specified host and port.

Parameters:
host - The host.
port - The port.
Method Detail

getSocket

protected Socket getSocket()
Returns:
the socket

getWriter

protected SocketWriter getWriter()
Description copied from class: AbstractTcpSendingMessageHandler
Returns the socket writer after instantiating it, if necessary.

Specified by:
getWriter in class AbstractTcpSendingMessageHandler
Returns:
the writer

setCustomSocketWriterClassName

public void setCustomSocketWriterClassName(String customSocketWriterClassName)
                                    throws ClassNotFoundException
Parameters:
customSocketWriterClassName - the customSocketWriterClassName to set
Throws:
ClassNotFoundException

close

protected void close()
Close the underlying socket and prepare to establish a new socket on the next write.


setLocalAddress

public void setLocalAddress(String localAddress)
Description copied from interface: CommonSocketOptions
On a multi-homed system, specifies the ip address of the network interface used to communicate. For inbound adapters and gateways, specifies the interface used to listed for incoming connections. If omitted, the endpoint will listen on all available adapters. For the UDP multicast outbound adapter specifies the interface to which multicast packets will be sent. For UDP unicast and multicast adapters, specifies which interface to which the acknowledgment socket will be bound. Does not apply to TCP outbound adapters and gateways.


Spring Integration

Copyright © 2010. All Rights Reserved.