Spring Integration

org.springframework.integration.ip.tcp.connection
Class AbstractConnectionFactory

java.lang.Object
  extended by org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
All Implemented Interfaces:
Runnable, Lifecycle, ConnectionFactory
Direct Known Subclasses:
AbstractClientConnectionFactory, AbstractServerConnectionFactory

public abstract class AbstractConnectionFactory
extends Object
implements ConnectionFactory, Runnable, Lifecycle

Base class for all connection factories.

Since:
2.0
Author:
Gary Russell

Field Summary
protected  boolean active
           
protected static int DEFAULT_REPLY_TIMEOUT
           
protected  String host
           
protected  InputStreamingConverter<?> inputConverter
           
protected  TcpListener listener
           
protected  org.apache.commons.logging.Log logger
           
protected  TcpMessageMapper mapper
           
protected  OutputStreamingConverter<?> outputConverter
           
protected  int poolSize
           
protected  int port
           
protected  TcpSender sender
           
protected  boolean singleUse
           
protected  int soTimeout
           
protected  Executor taskExecutor
           
 
Constructor Summary
AbstractConnectionFactory()
           
 
Method Summary
abstract  void close()
          Closes the server.
 String getHost()
           
 int getPort()
           
 int getSoLinger()
           
 int getSoReceiveBufferSize()
           
 int getSoSendBufferSize()
           
 int getSoTimeout()
           
 int getSoTrafficClass()
           
 boolean isSoKeepAlive()
           
 boolean isSoTcpNoDelay()
           
 void registerListener(TcpListener listener)
          Registers a TcpListener to receive messages after the payload has been converted from the input data.
 void registerSender(TcpSender sender)
          Registers a TcpSender; for server sockets, used to provide connection information so a sender can be used to reply to incoming messages.
 void setInputConverter(InputStreamingConverter<?> converter)
           
 void setMapper(TcpMessageMapper mapper)
           
 void setOutputConverter(OutputStreamingConverter<?> outputConverter)
           
 void setPoolSize(int poolSize)
           
 void setSingleUse(boolean singleUse)
          If true, sockets created by this factory will be used once.
protected  void setSocketAttributes(Socket socket)
          Sets socket attributes on the socket.
 void setSoKeepAlive(boolean soKeepAlive)
           
 void setSoLinger(int soLinger)
           
 void setSoReceiveBufferSize(int soReceiveBufferSize)
           
 void setSoSendBufferSize(int soSendBufferSize)
           
 void setSoTcpNoDelay(boolean soTcpNoDelay)
           
 void setSoTimeout(int soTimeout)
           
 void setSoTrafficClass(int soTrafficClass)
           
 void setTaskExecutor(Executor taskExecutor)
           
 void start()
          Creates a taskExecutor (if one was not provided) and starts the listening process on one of its threads.
 void stop()
          Stops the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.integration.ip.tcp.connection.ConnectionFactory
getConnection
 
Methods inherited from interface java.lang.Runnable
run
 
Methods inherited from interface org.springframework.context.Lifecycle
isRunning
 

Field Detail

logger

protected org.apache.commons.logging.Log logger

DEFAULT_REPLY_TIMEOUT

protected static final int DEFAULT_REPLY_TIMEOUT
See Also:
Constant Field Values

host

protected String host

port

protected int port

listener

protected TcpListener listener

sender

protected TcpSender sender

soTimeout

protected int soTimeout

taskExecutor

protected Executor taskExecutor

inputConverter

protected InputStreamingConverter<?> inputConverter

outputConverter

protected OutputStreamingConverter<?> outputConverter

mapper

protected TcpMessageMapper mapper

singleUse

protected boolean singleUse

poolSize

protected int poolSize

active

protected boolean active
Constructor Detail

AbstractConnectionFactory

public AbstractConnectionFactory()
Method Detail

setSocketAttributes

protected void setSocketAttributes(Socket socket)
                            throws SocketException
Sets socket attributes on the socket.

Parameters:
socket - The socket.
Throws:
SocketException

getSoTimeout

public int getSoTimeout()
Returns:
the soTimeout

setSoTimeout

public void setSoTimeout(int soTimeout)
Parameters:
soTimeout - the soTimeout to set

getSoReceiveBufferSize

public int getSoReceiveBufferSize()
Returns:
the soReceiveBufferSize

setSoReceiveBufferSize

public void setSoReceiveBufferSize(int soReceiveBufferSize)
Parameters:
soReceiveBufferSize - the soReceiveBufferSize to set

getSoSendBufferSize

public int getSoSendBufferSize()
Returns:
the soSendBufferSize

setSoSendBufferSize

public void setSoSendBufferSize(int soSendBufferSize)
Parameters:
soSendBufferSize - the soSendBufferSize to set

isSoTcpNoDelay

public boolean isSoTcpNoDelay()
Returns:
the soTcpNoDelay

setSoTcpNoDelay

public void setSoTcpNoDelay(boolean soTcpNoDelay)
Parameters:
soTcpNoDelay - the soTcpNoDelay to set

getSoLinger

public int getSoLinger()
Returns:
the soLinger

setSoLinger

public void setSoLinger(int soLinger)
Parameters:
soLinger - the soLinger to set

isSoKeepAlive

public boolean isSoKeepAlive()
Returns:
the soKeepAlive

setSoKeepAlive

public void setSoKeepAlive(boolean soKeepAlive)
Parameters:
soKeepAlive - the soKeepAlive to set

getSoTrafficClass

public int getSoTrafficClass()
Returns:
the soTrafficClass

setSoTrafficClass

public void setSoTrafficClass(int soTrafficClass)
Parameters:
soTrafficClass - the soTrafficClass to set

getHost

public String getHost()
Returns:
the host

getPort

public int getPort()
Returns:
the port

registerListener

public void registerListener(TcpListener listener)
Registers a TcpListener to receive messages after the payload has been converted from the input data.

Parameters:
listener - the TcpListener.

registerSender

public void registerSender(TcpSender sender)
Registers a TcpSender; for server sockets, used to provide connection information so a sender can be used to reply to incoming messages.

Parameters:
sender - The sender

setTaskExecutor

public void setTaskExecutor(Executor taskExecutor)
Parameters:
taskExecutor - the taskExecutor to set

setInputConverter

public void setInputConverter(InputStreamingConverter<?> converter)
Parameters:
converter - the inputConverter to set

setOutputConverter

public void setOutputConverter(OutputStreamingConverter<?> outputConverter)
Parameters:
outputConverter - the outputConverter to set

setMapper

public void setMapper(TcpMessageMapper mapper)
Parameters:
mapper - the mapper to set; defaults to a TcpMessageMapper

setSingleUse

public void setSingleUse(boolean singleUse)
If true, sockets created by this factory will be used once.

Parameters:
singleUse -

setPoolSize

public void setPoolSize(int poolSize)

close

public abstract void close()
Closes the server.


start

public void start()
Creates a taskExecutor (if one was not provided) and starts the listening process on one of its threads.

Specified by:
start in interface Lifecycle

stop

public void stop()
Stops the server.

Specified by:
stop in interface Lifecycle

Spring Integration

Copyright © 2010. All Rights Reserved.