Spring Integration

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

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

public abstract class AbstractServerConnectionFactory
extends AbstractConnectionFactory

Base class for all server connection factories. Server connection factories listen on a port for incoming connections and create new TcpConnection objects for each new connection.

Author:
Gary Russell

Field Summary
protected  boolean listening
           
protected  String localAddress
           
 
Fields inherited from class org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
active, DEFAULT_REPLY_TIMEOUT, host, inputConverter, interceptorFactoryChain, listener, logger, mapper, outputConverter, poolSize, port, sender, singleUse, soTimeout, taskExecutor
 
Constructor Summary
AbstractServerConnectionFactory(int port)
          The port on which the factory will listen.
 
Method Summary
 TcpConnection getConnection()
          Not supported because the factory manages multiple connections and this method cannot discriminate.
 String getLocalAddress()
           
protected  void initializeConnection(TcpConnection connection, Socket socket)
          Transfers attributes such as converters, singleUse etc to a new connection.
 boolean isListening()
           
 void setLocalAddress(String localAddress)
          Used on multi-homed systems to enforce the server to listen on a specfic network address instead of all network adapters.
 
Methods inherited from class org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
close, getHost, getPhase, getPort, getSoLinger, getSoReceiveBufferSize, getSoSendBufferSize, getSoTimeout, getSoTrafficClass, isAutoStartup, isSingleUse, isSoKeepAlive, isSoTcpNoDelay, registerListener, registerSender, setInputConverter, setInterceptorFactoryChain, setMapper, setOutputConverter, setPoolSize, setSingleUse, setSocketAttributes, setSoKeepAlive, setSoLinger, setSoReceiveBufferSize, setSoSendBufferSize, setSoTcpNoDelay, setSoTimeout, setSoTrafficClass, setTaskExecutor, start, stop, stop, wrapConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 
Methods inherited from interface org.springframework.context.Lifecycle
isRunning
 

Field Detail

listening

protected boolean listening

localAddress

protected String localAddress
Constructor Detail

AbstractServerConnectionFactory

public AbstractServerConnectionFactory(int port)
The port on which the factory will listen.

Parameters:
port -
Method Detail

getConnection

public TcpConnection getConnection()
                            throws Exception
Not supported because the factory manages multiple connections and this method cannot discriminate.

Throws:
Exception

isListening

public boolean isListening()
Returns:
true if the server is listening on the port.

initializeConnection

protected void initializeConnection(TcpConnection connection,
                                    Socket socket)
Transfers attributes such as converters, singleUse etc to a new connection. For single use sockets, enforces a socket timeout (default 10 seconds).

Parameters:
connection - The new connection.
socket - The new socket.

getLocalAddress

public String getLocalAddress()
Returns:
the localAddress

setLocalAddress

public void setLocalAddress(String localAddress)
Used on multi-homed systems to enforce the server to listen on a specfic network address instead of all network adapters.

Parameters:
localAddress - the ip address of the required adapter.

Spring Integration

Copyright © 2010. All Rights Reserved.