org.springframework.integration.ip.tcp.connection
Class TcpNioServerConnectionFactory
java.lang.Object
org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory
org.springframework.integration.ip.tcp.connection.TcpNioServerConnectionFactory
- All Implemented Interfaces:
- Runnable, Lifecycle, Phased, SmartLifecycle, ConnectionFactory
public class TcpNioServerConnectionFactory
- extends AbstractServerConnectionFactory
/**
Implements a server connection factory that produces TcpNioConnection
s using
a ServerSocketChannel
. Must have a TcpListener
registered.
- Since:
- 2.0
- Author:
- Gary Russell
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 |
Methods inherited from class org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory |
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 |
serverChannel
protected ServerSocketChannel serverChannel
usingDirectBuffers
protected boolean usingDirectBuffers
connections
protected Map<SocketChannel,TcpNioConnection> connections
TcpNioServerConnectionFactory
public TcpNioServerConnectionFactory(int port)
- Listens for incoming connections on the port.
- Parameters:
port
- The port.
run
public void run()
- If no listener registers, exits.
Accepts incoming connections and creates TcpConnections for each new connection.
Invokes {
AbstractServerConnectionFactory.initializeConnection(TcpConnection, 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.
isRunning
public boolean isRunning()
close
public void close()
- Description copied from class:
AbstractConnectionFactory
- Closes the server.
- Specified by:
close
in class AbstractConnectionFactory
setUsingDirectBuffers
public void setUsingDirectBuffers(boolean usingDirectBuffers)
Copyright © 2010. All Rights Reserved.