public class TcpNioServerConnectionFactory extends AbstractServerConnectionFactory
TcpNioConnections using
a ServerSocketChannel. Must have a TcpListener registered.DEFAULT_REPLY_TIMEOUT, lifecycleMonitorEXPRESSION_PARSER, logger| Constructor and Description |
|---|
TcpNioServerConnectionFactory(int port)
Listens for incoming connections on the port.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doAccept(java.nio.channels.Selector selector,
java.nio.channels.ServerSocketChannel server,
long now) |
java.lang.String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
protected java.util.Map<java.nio.channels.SocketChannel,TcpNioConnection> |
getConnections() |
int |
getPort()
Return the port this server is listening on.
|
protected java.nio.channels.ServerSocketChannel |
getServerChannel() |
java.net.SocketAddress |
getServerSocketAddress()
Return the
SocketAddress that the underlying ServerSocket
is bound to. |
protected boolean |
isUsingDirectBuffers() |
void |
run()
If no listener registers, exits.
|
void |
setTcpNioConnectionSupport(TcpNioConnectionSupport tcpNioSupport) |
void |
setUsingDirectBuffers(boolean usingDirectBuffers) |
void |
stop()
Stops the server.
|
afterShutdown, beforeShutdown, getBacklog, getConnection, getLocalAddress, initializeConnection, isListening, isLongLived, isShuttingDown, postProcessServerSocket, publishServerExceptionEvent, publishServerListeningEvent, setBacklog, setListening, setLocalAddress, startaddConnection, checkActive, closeConnection, delayRead, getApplicationEventPublisher, getDelayedReads, getDeserializer, getHost, getListener, getMapper, getOpenConnectionIds, getReadDelay, getSender, 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, wrapConnectionafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskSchedulerpublic TcpNioServerConnectionFactory(int port)
port - The port.public java.lang.String getComponentType()
IntegrationObjectSupportgetComponentType in interface NamedComponentgetComponentType in class IntegrationObjectSupportpublic int getPort()
TcpServerConnectionFactorygetPort in interface TcpServerConnectionFactorygetPort in class AbstractConnectionFactory@Nullable public java.net.SocketAddress getServerSocketAddress()
TcpServerConnectionFactorySocketAddress that the underlying ServerSocket
is bound to.getServerSocketAddress in interface TcpServerConnectionFactorygetServerSocketAddress in class AbstractServerConnectionFactorypublic void run()
AbstractServerConnectionFactory.initializeConnection(TcpConnectionSupport, Socket) and executes the
connection Runnable.run() using the task executor.
I/O errors on the server socket/channel are logged and the factory is stopped.protected void doAccept(java.nio.channels.Selector selector,
java.nio.channels.ServerSocketChannel server,
long now)
throws java.io.IOException
doAccept in class AbstractConnectionFactoryselector - The selector.server - The server socket channel.now - The current time.java.io.IOException - Any IOException.public void stop()
AbstractConnectionFactorystop in interface org.springframework.context.Lifecyclestop in class AbstractConnectionFactorypublic void setUsingDirectBuffers(boolean usingDirectBuffers)
public void setTcpNioConnectionSupport(TcpNioConnectionSupport tcpNioSupport)
protected java.nio.channels.ServerSocketChannel getServerChannel()
protected boolean isUsingDirectBuffers()
protected java.util.Map<java.nio.channels.SocketChannel,TcpNioConnection> getConnections()