Class TcpNioClientConnectionFactory
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory
org.springframework.integration.ip.tcp.connection.TcpNioClientConnectionFactory
- All Implemented Interfaces:
Runnable
,Aware
,BeanFactoryAware
,BeanNameAware
,InitializingBean
,ApplicationContextAware
,ApplicationEventPublisherAware
,Lifecycle
,ExpressionCapable
,ConnectionFactory
,NamedComponent
,ManageableLifecycle
,SchedulingAwareRunnable
public class TcpNioClientConnectionFactory
extends AbstractClientConnectionFactory
implements SchedulingAwareRunnable
A client connection factory that creates
TcpNioConnection
s.- Since:
- 2.0
- Author:
- Gary Russell, Artem Bilan, Christian Tzolov
-
Field Summary
Fields inherited from class org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
DEFAULT_REPLY_TIMEOUT, lifecycleMonitor
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
-
Constructor Summary
ConstructorDescriptionTcpNioClientConnectionFactory
(String host, int port) Creates a TcpNioClientConnectionFactory for connections to the host and port. -
Method Summary
Modifier and TypeMethodDescriptionprotected TcpConnectionSupport
protected void
protected Map<SocketChannel,
TcpNioConnection> protected BlockingQueue<SocketChannel>
boolean
protected boolean
void
run()
void
setTcpNioConnectionSupport
(TcpNioConnectionSupport tcpNioSupport) void
setUsingDirectBuffers
(boolean usingDirectBuffers) When set to true, connections created by this factory attempt to use direct buffers where possible.void
start()
void
stop()
Stops the server.Methods inherited from class org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory
enableManualListenerRegistration, forceClose, getConnection, getConnectionTest, getConnectTimeout, getTheConnection, initializeConnection, obtainConnection, obtainNewConnection, obtainSharedConnection, setConnectionTest, setConnectTimeout, setTheConnection
Methods inherited from class org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
addConnection, closeConnection, delayRead, doAccept, getApplicationEventPublisher, getDelayedReads, getDeserializer, getHost, getLifecycleMonitor, getListener, getMapper, getOpenConnectionIds, getPort, getReadDelay, getSender, getSenders, getSerializer, getSoLinger, getSoReceiveBufferSize, getSoSendBufferSize, getSoTimeout, getSoTrafficClass, getSslHandshakeTimeout, getTaskExecutor, getTcpSocketSupport, harvestClosedConnections, isActive, isLookupHost, isRunning, isSingleUse, isSoKeepAlive, isSoTcpNoDelay, onInit, processNioSelections, registerListener, registerSender, setActive, setApplicationEventPublisher, setDeserializer, setHost, setInterceptorFactoryChain, setLeaveOpen, setLookupHost, setMapper, setNioHarvestInterval, setPort, setReadDelay, setSerializer, setSingleUse, setSocketAttributes, setSoKeepAlive, setSoLinger, setSoReceiveBufferSize, setSoSendBufferSize, setSoTcpNoDelay, setSoTimeout, setSoTrafficClass, setSslHandshakeTimeout, setTaskExecutor, setTcpSocketSupport, toString, unregisterSender, wrapConnection
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.scheduling.SchedulingAwareRunnable
getQualifier
-
Constructor Details
-
TcpNioClientConnectionFactory
Creates a TcpNioClientConnectionFactory for connections to the host and port.- Parameters:
host
- the hostport
- the port
-
-
Method Details
-
checkActive
protected void checkActive()- Overrides:
checkActive
in classAbstractConnectionFactory
-
buildNewConnection
- Overrides:
buildNewConnection
in classAbstractClientConnectionFactory
-
setUsingDirectBuffers
public void setUsingDirectBuffers(boolean usingDirectBuffers) When set to true, connections created by this factory attempt to use direct buffers where possible.- Parameters:
usingDirectBuffers
- The usingDirectBuffers to set.- See Also:
-
setTcpNioConnectionSupport
-
isLongLived
public boolean isLongLived()- Specified by:
isLongLived
in interfaceSchedulingAwareRunnable
-
stop
public void stop()Description copied from class:AbstractConnectionFactory
Stops the server.- Specified by:
stop
in interfaceLifecycle
- Specified by:
stop
in interfaceManageableLifecycle
- Overrides:
stop
in classAbstractConnectionFactory
-
start
public void start()- Specified by:
start
in interfaceLifecycle
- Specified by:
start
in interfaceManageableLifecycle
- Overrides:
start
in classAbstractConnectionFactory
-
run
public void run() -
isUsingDirectBuffers
protected boolean isUsingDirectBuffers()- Returns:
- the usingDirectBuffers
-
getConnections
- Returns:
- the connections
-
getNewChannels
- Returns:
- the newChannels
-