Spring Integration

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

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
          extended by org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory
              extended by org.springframework.integration.ip.tcp.connection.CachingClientConnectionFactory
All Implemented Interfaces:
org.springframework.beans.factory.Aware, 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, NamedComponent, ConnectionFactory

public class CachingClientConnectionFactory
extends AbstractClientConnectionFactory

Since:
2.2
Author:
Gary Russell

Field Summary
 
Fields inherited from class org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
DEFAULT_REPLY_TIMEOUT, lifecycleMonitor
 
Constructor Summary
CachingClientConnectionFactory(AbstractClientConnectionFactory target, int poolSize)
           
 
Method Summary
 void close()
          Closes the server.
 boolean equals(java.lang.Object obj)
           
 int getActiveCount()
           
 int getAllocatedCount()
           
 java.lang.String getComponentType()
          Subclasses may implement this method to provide component type information.
 org.springframework.core.serializer.Deserializer<?> getDeserializer()
           
 java.lang.String getHost()
           
 int getIdleCount()
           
 TcpListener getListener()
           
 TcpMessageMapper getMapper()
           
 int getPhase()
           
 int getPoolSize()
           
 int getPort()
           
 TcpSender getSender()
           
 org.springframework.core.serializer.Serializer<?> getSerializer()
           
 int getSoLinger()
           
 int getSoReceiveBufferSize()
           
 int getSoSendBufferSize()
           
 int getSoTimeout()
           
 int getSoTrafficClass()
           
 int hashCode()
           
 boolean isAutoStartup()
          We are controlled by the startup options of the bound endpoint.
 boolean isLookupHost()
           
 boolean isRunning()
           
 boolean isSingleUse()
           
 boolean isSoKeepAlive()
           
 boolean isSoTcpNoDelay()
           
 TcpConnection obtainConnection()
           
 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 setComponentName(java.lang.String componentName)
          Sets the name of this component.
 void setConnectionWaitTimeout(int connectionWaitTimeout)
           
 void setDeserializer(org.springframework.core.serializer.Deserializer<?> deserializer)
           
 void setInterceptorFactoryChain(TcpConnectionInterceptorFactoryChain interceptorFactoryChain)
           
 void setLookupHost(boolean lookupHost)
          If true, DNS reverse lookup is done on the remote ip address.
 void setMapper(TcpMessageMapper mapper)
           
 void setPoolSize(int poolSize)
           
 void setSerializer(org.springframework.core.serializer.Serializer<?> serializer)
           
 void setSingleUse(boolean singleUse)
          If true, sockets created by this factory will be used once.
 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(java.util.concurrent.Executor taskExecutor)
           
 void start()
           
 void stop()
          Stops the server.
 void stop(java.lang.Runnable callback)
           
 
Methods inherited from class org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory
forceClose, getConnection, getTheConnection, initializeConnection, setTheConnection
 
Methods inherited from class org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
addConnection, checkActive, doAccept, getTaskExecutor, getTcpSocketSupport, harvestClosedConnections, isActive, processNioSelections, setActive, setNioHarvestInterval, setSocketAttributes, setTcpSocketSupport, wrapConnection
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, onInit, setBeanFactory, setBeanName, setConversionService, setTaskScheduler, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CachingClientConnectionFactory

public CachingClientConnectionFactory(AbstractClientConnectionFactory target,
                                      int poolSize)
Method Detail

setConnectionWaitTimeout

public void setConnectionWaitTimeout(int connectionWaitTimeout)

setPoolSize

public void setPoolSize(int poolSize)
Overrides:
setPoolSize in class AbstractConnectionFactory

getPoolSize

public int getPoolSize()
Overrides:
getPoolSize in class AbstractConnectionFactory
Returns:
the poolSize

getIdleCount

public int getIdleCount()

getActiveCount

public int getActiveCount()

getAllocatedCount

public int getAllocatedCount()

obtainConnection

public TcpConnection obtainConnection()
                               throws java.lang.Exception
Specified by:
obtainConnection in class AbstractClientConnectionFactory
Throws:
java.lang.Exception

isRunning

public boolean isRunning()
Specified by:
isRunning in interface org.springframework.context.Lifecycle
Overrides:
isRunning in class AbstractConnectionFactory

close

public void close()
Description copied from class: AbstractConnectionFactory
Closes the server.

Specified by:
close in class AbstractConnectionFactory

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

setComponentName

public void setComponentName(java.lang.String componentName)
Description copied from class: IntegrationObjectSupport
Sets the name of this component.

Overrides:
setComponentName in class IntegrationObjectSupport

getComponentType

public java.lang.String getComponentType()
Description copied from class: IntegrationObjectSupport
Subclasses may implement this method to provide component type information.

Specified by:
getComponentType in interface NamedComponent
Overrides:
getComponentType in class IntegrationObjectSupport

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getSoTimeout

public int getSoTimeout()
Overrides:
getSoTimeout in class AbstractConnectionFactory
Returns:
the soTimeout

setSoTimeout

public void setSoTimeout(int soTimeout)
Overrides:
setSoTimeout in class AbstractConnectionFactory
Parameters:
soTimeout - the soTimeout to set

getSoReceiveBufferSize

public int getSoReceiveBufferSize()
Overrides:
getSoReceiveBufferSize in class AbstractConnectionFactory
Returns:
the soReceiveBufferSize

setSoReceiveBufferSize

public void setSoReceiveBufferSize(int soReceiveBufferSize)
Overrides:
setSoReceiveBufferSize in class AbstractConnectionFactory
Parameters:
soReceiveBufferSize - the soReceiveBufferSize to set

getSoSendBufferSize

public int getSoSendBufferSize()
Overrides:
getSoSendBufferSize in class AbstractConnectionFactory
Returns:
the soSendBufferSize

setSoSendBufferSize

public void setSoSendBufferSize(int soSendBufferSize)
Overrides:
setSoSendBufferSize in class AbstractConnectionFactory
Parameters:
soSendBufferSize - the soSendBufferSize to set

isSoTcpNoDelay

public boolean isSoTcpNoDelay()
Overrides:
isSoTcpNoDelay in class AbstractConnectionFactory
Returns:
the soTcpNoDelay

setSoTcpNoDelay

public void setSoTcpNoDelay(boolean soTcpNoDelay)
Overrides:
setSoTcpNoDelay in class AbstractConnectionFactory
Parameters:
soTcpNoDelay - the soTcpNoDelay to set

getSoLinger

public int getSoLinger()
Overrides:
getSoLinger in class AbstractConnectionFactory
Returns:
the soLinger

setSoLinger

public void setSoLinger(int soLinger)
Overrides:
setSoLinger in class AbstractConnectionFactory
Parameters:
soLinger - the soLinger to set

isSoKeepAlive

public boolean isSoKeepAlive()
Overrides:
isSoKeepAlive in class AbstractConnectionFactory
Returns:
the soKeepAlive

setSoKeepAlive

public void setSoKeepAlive(boolean soKeepAlive)
Overrides:
setSoKeepAlive in class AbstractConnectionFactory
Parameters:
soKeepAlive - the soKeepAlive to set

getSoTrafficClass

public int getSoTrafficClass()
Overrides:
getSoTrafficClass in class AbstractConnectionFactory
Returns:
the soTrafficClass

setSoTrafficClass

public void setSoTrafficClass(int soTrafficClass)
Overrides:
setSoTrafficClass in class AbstractConnectionFactory
Parameters:
soTrafficClass - the soTrafficClass to set

getHost

public java.lang.String getHost()
Overrides:
getHost in class AbstractConnectionFactory
Returns:
the host

getPort

public int getPort()
Overrides:
getPort in class AbstractConnectionFactory
Returns:
the port

getListener

public TcpListener getListener()
Overrides:
getListener in class AbstractConnectionFactory
Returns:
the listener

getSender

public TcpSender getSender()
Overrides:
getSender in class AbstractConnectionFactory
Returns:
the sender

getSerializer

public org.springframework.core.serializer.Serializer<?> getSerializer()
Overrides:
getSerializer in class AbstractConnectionFactory
Returns:
the serializer

getDeserializer

public org.springframework.core.serializer.Deserializer<?> getDeserializer()
Overrides:
getDeserializer in class AbstractConnectionFactory
Returns:
the deserializer

getMapper

public TcpMessageMapper getMapper()
Overrides:
getMapper in class AbstractConnectionFactory
Returns:
the mapper

registerListener

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

Overrides:
registerListener in class AbstractConnectionFactory
Parameters:
listener - the TcpListener.

registerSender

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

Overrides:
registerSender in class AbstractConnectionFactory
Parameters:
sender - The sender

setTaskExecutor

public void setTaskExecutor(java.util.concurrent.Executor taskExecutor)
Overrides:
setTaskExecutor in class AbstractConnectionFactory
Parameters:
taskExecutor - the taskExecutor to set

setDeserializer

public void setDeserializer(org.springframework.core.serializer.Deserializer<?> deserializer)
Overrides:
setDeserializer in class AbstractConnectionFactory
Parameters:
deserializer - the deserializer to set

setSerializer

public void setSerializer(org.springframework.core.serializer.Serializer<?> serializer)
Overrides:
setSerializer in class AbstractConnectionFactory
Parameters:
serializer - the serializer to set

setMapper

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

isSingleUse

public boolean isSingleUse()
Overrides:
isSingleUse in class AbstractConnectionFactory
Returns:
the singleUse

setSingleUse

public void setSingleUse(boolean singleUse)
Description copied from class: AbstractConnectionFactory
If true, sockets created by this factory will be used once.

Overrides:
setSingleUse in class AbstractConnectionFactory

setInterceptorFactoryChain

public void setInterceptorFactoryChain(TcpConnectionInterceptorFactoryChain interceptorFactoryChain)
Overrides:
setInterceptorFactoryChain in class AbstractConnectionFactory

setLookupHost

public void setLookupHost(boolean lookupHost)
Description copied from class: AbstractConnectionFactory
If true, DNS reverse lookup is done on the remote ip address. Default true.

Overrides:
setLookupHost in class AbstractConnectionFactory
Parameters:
lookupHost - the lookupHost to set

isLookupHost

public boolean isLookupHost()
Overrides:
isLookupHost in class AbstractConnectionFactory
Returns:
the lookupHost

start

public void start()
Specified by:
start in interface org.springframework.context.Lifecycle
Overrides:
start in class AbstractConnectionFactory

stop

public void stop()
Description copied from class: AbstractConnectionFactory
Stops the server.

Specified by:
stop in interface org.springframework.context.Lifecycle
Overrides:
stop in class AbstractConnectionFactory

getPhase

public int getPhase()
Specified by:
getPhase in interface org.springframework.context.Phased
Overrides:
getPhase in class AbstractConnectionFactory

isAutoStartup

public boolean isAutoStartup()
Description copied from class: AbstractConnectionFactory
We are controlled by the startup options of the bound endpoint.

Specified by:
isAutoStartup in interface org.springframework.context.SmartLifecycle
Overrides:
isAutoStartup in class AbstractConnectionFactory

stop

public void stop(java.lang.Runnable callback)
Specified by:
stop in interface org.springframework.context.SmartLifecycle
Overrides:
stop in class AbstractConnectionFactory

Spring Integration