public class ThreadAffinityClientConnectionFactory extends AbstractClientConnectionFactory
releaseConnection().DEFAULT_REPLY_TIMEOUT, lifecycleMonitorEXPRESSION_PARSER, logger| Constructor and Description |
|---|
ThreadAffinityClientConnectionFactory(AbstractClientConnectionFactory connectionFactory) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
closeConnection(String connectionId)
Close a connection with the specified connection id.
|
void |
enableManualListenerRegistration()
Set whether to automatically (default) or manually add a
TcpListener to the
connections created by this factory. |
void |
forceClose(TcpConnection connection)
Force close the connection and null the field if it's
a shared connection.
|
String |
getApplicationContextId()
Returns the
ApplicationContext.getId() if the
ApplicationContext is available. |
ApplicationEventPublisher |
getApplicationEventPublisher() |
String |
getComponentName()
Will return the name of this component identified by
IntegrationObjectSupport.componentName field. |
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
TcpConnectionSupport |
getConnection()
Obtains a connection - if
AbstractConnectionFactory.setSingleUse(boolean) was called with
true, a new connection is returned; otherwise a single connection is
reused for all requests while the connection remains open. |
ConversionService |
getConversionService() |
Deserializer<?> |
getDeserializer() |
Expression |
getExpression()
Return the primary SpEL expression if this component is expression-based.
|
String |
getHost() |
TcpListener |
getListener() |
TcpMessageMapper |
getMapper() |
List<String> |
getOpenConnectionIds()
Returns a list of (currently) open
TcpConnection connection ids; allows,
for example, broadcast operations to all open connections. |
int |
getPort() |
TcpSender |
getSender() |
Serializer<?> |
getSerializer() |
int |
getSoLinger() |
int |
getSoReceiveBufferSize() |
int |
getSoSendBufferSize() |
int |
getSoTimeout() |
int |
getSoTrafficClass() |
boolean |
isLookupHost() |
boolean |
isRunning() |
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 |
releaseConnection() |
void |
setApplicationContext(ApplicationContext applicationContext) |
void |
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) |
void |
setBeanFactory(BeanFactory beanFactory) |
void |
setChannelResolver(DestinationResolver<MessageChannel> channelResolver)
Specify the
DestinationResolver strategy to use. |
void |
setComponentName(String componentName)
Sets the name of this component.
|
void |
setDeserializer(Deserializer<?> deserializer) |
void |
setHost(String host)
Set the host; requires the factory to be stopped.
|
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 |
setMessageBuilderFactory(MessageBuilderFactory messageBuilderFactory) |
void |
setNioHarvestInterval(int nioHarvestInterval)
How often we clean up closed NIO connections if soTimeout is 0.
|
void |
setPort(int port)
Set the port; requires the factory to be stopped.
|
void |
setReadDelay(long readDelay)
The delay (in milliseconds) before retrying a read after the previous attempt
failed due to insufficient threads.
|
void |
setSerializer(Serializer<?> serializer) |
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 |
setSslHandshakeTimeout(int sslHandshakeTimeout)
Set the handshake timeout used when waiting for SSL handshake data; only applies
to SSL connections, when using NIO.
|
void |
setTaskExecutor(Executor taskExecutor) |
void |
setTcpSocketSupport(TcpSocketSupport tcpSocketSupport) |
void |
start() |
void |
stop()
Stops the server.
|
String |
toString() |
buildNewConnection, getTheConnection, initializeConnection, obtainConnection, obtainNewConnection, obtainSharedConnection, setTheConnectionaddConnection, checkActive, delayRead, doAccept, getDelayedReads, getLifecycleMonitor, getReadDelay, getSslHandshakeTimeout, getTaskExecutor, getTcpSocketSupport, harvestClosedConnections, isActive, isSingleUse, onInit, processNioSelections, setActive, setLeaveOpen, setSingleUse, setSocketAttributes, wrapConnectionafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getBeanFactory, getBeanName, getChannelResolver, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setBeanName, setConversionService, setPrimaryExpression, setTaskSchedulerpublic ThreadAffinityClientConnectionFactory(AbstractClientConnectionFactory connectionFactory)
public TcpConnectionSupport getConnection() throws InterruptedException
AbstractClientConnectionFactoryAbstractConnectionFactory.setSingleUse(boolean) was called with
true, a new connection is returned; otherwise a single connection is
reused for all requests while the connection remains open.getConnection in interface ConnectionFactorygetConnection in class AbstractClientConnectionFactoryInterruptedException - if interrupted.public void releaseConnection()
public void enableManualListenerRegistration()
AbstractClientConnectionFactoryTcpListener to the
connections created by this factory. By default, the factory automatically configures
the listener. When manual registration is in place, incoming messages will be delayed
until the listener is registered.enableManualListenerRegistration in class AbstractClientConnectionFactorypublic String getComponentName()
IntegrationObjectSupportIntegrationObjectSupport.componentName field.
If IntegrationObjectSupport.componentName was not set this method will default to the 'beanName' of this component;getComponentName in interface NamedComponentgetComponentName in class IntegrationObjectSupportpublic void setComponentName(String componentName)
IntegrationObjectSupportsetComponentName in class IntegrationObjectSupportcomponentName - The component name.public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface ApplicationEventPublisherAwaresetApplicationEventPublisher in class AbstractConnectionFactorypublic String getComponentType()
IntegrationObjectSupportgetComponentType in interface NamedComponentgetComponentType in class IntegrationObjectSupportpublic void setBeanFactory(BeanFactory beanFactory)
setBeanFactory in interface BeanFactoryAwaresetBeanFactory in class IntegrationObjectSupportpublic void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext in interface ApplicationContextAwaresetApplicationContext in class IntegrationObjectSupportBeansExceptionpublic ApplicationEventPublisher getApplicationEventPublisher()
getApplicationEventPublisher in class AbstractConnectionFactorypublic void setChannelResolver(DestinationResolver<MessageChannel> channelResolver)
IntegrationObjectSupportDestinationResolver strategy to use.
The default is a BeanFactoryChannelResolver.setChannelResolver in class IntegrationObjectSupportchannelResolver - The channel resolver.public Expression getExpression()
ExpressionCapablegetExpression in interface ExpressionCapablegetExpression in class IntegrationObjectSupportpublic void forceClose(TcpConnection connection)
AbstractClientConnectionFactoryforceClose in class AbstractClientConnectionFactoryconnection - The connection.public int getSoTimeout()
getSoTimeout in class AbstractConnectionFactorypublic void setSoTimeout(int soTimeout)
setSoTimeout in class AbstractConnectionFactorysoTimeout - the soTimeout to setpublic int getSoReceiveBufferSize()
getSoReceiveBufferSize in class AbstractConnectionFactorypublic void setSoReceiveBufferSize(int soReceiveBufferSize)
setSoReceiveBufferSize in class AbstractConnectionFactorysoReceiveBufferSize - the soReceiveBufferSize to setpublic int getSoSendBufferSize()
getSoSendBufferSize in class AbstractConnectionFactorypublic void setSoSendBufferSize(int soSendBufferSize)
setSoSendBufferSize in class AbstractConnectionFactorysoSendBufferSize - the soSendBufferSize to setpublic boolean isSoTcpNoDelay()
isSoTcpNoDelay in class AbstractConnectionFactorypublic void setSoTcpNoDelay(boolean soTcpNoDelay)
setSoTcpNoDelay in class AbstractConnectionFactorysoTcpNoDelay - the soTcpNoDelay to setpublic int getSoLinger()
getSoLinger in class AbstractConnectionFactorypublic void setSoLinger(int soLinger)
setSoLinger in class AbstractConnectionFactorysoLinger - the soLinger to setpublic boolean isSoKeepAlive()
isSoKeepAlive in class AbstractConnectionFactorypublic void setSoKeepAlive(boolean soKeepAlive)
setSoKeepAlive in class AbstractConnectionFactorysoKeepAlive - the soKeepAlive to setpublic ConversionService getConversionService()
getConversionService in class IntegrationObjectSupportpublic int getSoTrafficClass()
getSoTrafficClass in class AbstractConnectionFactorypublic void setSoTrafficClass(int soTrafficClass)
setSoTrafficClass in class AbstractConnectionFactorysoTrafficClass - the soTrafficClass to setpublic void setHost(String host)
AbstractConnectionFactorysetHost in class AbstractConnectionFactoryhost - the host.public String getHost()
getHost in class AbstractConnectionFactorypublic void setPort(int port)
AbstractConnectionFactorysetPort in class AbstractConnectionFactoryport - the port.public String getApplicationContextId()
IntegrationObjectSupportApplicationContext.getId() if the
ApplicationContext is available.getApplicationContextId in class IntegrationObjectSupportpublic int getPort()
getPort in class AbstractConnectionFactorypublic TcpListener getListener()
getListener in class AbstractConnectionFactorypublic TcpSender getSender()
getSender in class AbstractConnectionFactorypublic Serializer<?> getSerializer()
getSerializer in class AbstractConnectionFactorypublic Deserializer<?> getDeserializer()
getDeserializer in class AbstractConnectionFactorypublic TcpMessageMapper getMapper()
getMapper in class AbstractConnectionFactorypublic void registerListener(TcpListener listener)
AbstractConnectionFactoryregisterListener in class AbstractConnectionFactorylistener - the TcpListener.public void setMessageBuilderFactory(MessageBuilderFactory messageBuilderFactory)
setMessageBuilderFactory in class IntegrationObjectSupportpublic void registerSender(TcpSender sender)
AbstractConnectionFactoryregisterSender in class AbstractConnectionFactorysender - The senderpublic void setTaskExecutor(Executor taskExecutor)
setTaskExecutor in class AbstractConnectionFactorytaskExecutor - the taskExecutor to setpublic void setDeserializer(Deserializer<?> deserializer)
setDeserializer in class AbstractConnectionFactorydeserializer - the deserializer to setpublic void setSerializer(Serializer<?> serializer)
setSerializer in class AbstractConnectionFactoryserializer - the serializer to setpublic void setMapper(TcpMessageMapper mapper)
setMapper in class AbstractConnectionFactorymapper - the mapper to set; defaults to a TcpMessageMapperpublic void setInterceptorFactoryChain(TcpConnectionInterceptorFactoryChain interceptorFactoryChain)
setInterceptorFactoryChain in class AbstractConnectionFactorypublic void setLookupHost(boolean lookupHost)
AbstractConnectionFactorysetLookupHost in class AbstractConnectionFactorylookupHost - the lookupHost to setpublic boolean isLookupHost()
isLookupHost in class AbstractConnectionFactorypublic void setNioHarvestInterval(int nioHarvestInterval)
AbstractConnectionFactorysoTimeout > 0 because the clean up
process is run as part of the timeout handling.
Default 2000 milliseconds.setNioHarvestInterval in class AbstractConnectionFactorynioHarvestInterval - The interval in milliseconds.public void setSslHandshakeTimeout(int sslHandshakeTimeout)
AbstractConnectionFactorysetSslHandshakeTimeout in class AbstractConnectionFactorysslHandshakeTimeout - the timeout.public void setReadDelay(long readDelay)
AbstractConnectionFactorysetReadDelay in class AbstractConnectionFactoryreadDelay - the readDelay to set.public void start()
start in interface Lifecyclestart in class AbstractConnectionFactorypublic void stop()
AbstractConnectionFactorystop in interface Lifecyclestop in class AbstractConnectionFactorypublic boolean isRunning()
isRunning in interface LifecycleisRunning in class AbstractConnectionFactorypublic void setTcpSocketSupport(TcpSocketSupport tcpSocketSupport)
setTcpSocketSupport in class AbstractConnectionFactorypublic List<String> getOpenConnectionIds()
AbstractConnectionFactoryTcpConnection connection ids; allows,
for example, broadcast operations to all open connections.getOpenConnectionIds in class AbstractConnectionFactorypublic boolean closeConnection(String connectionId)
AbstractConnectionFactorycloseConnection in class AbstractConnectionFactoryconnectionId - the connection id.public String toString()
toString in class AbstractConnectionFactory