public class TcpNetServerConnectionFactory extends AbstractServerConnectionFactory
TcpNetConnection
s using
a ServerSocket
. Must have a TcpListener
registered.DEFAULT_REPLY_TIMEOUT, lifecycleMonitor
logger
Constructor and Description |
---|
TcpNetServerConnectionFactory(int port)
Listens for incoming connections on the port.
|
Modifier and Type | Method and Description |
---|---|
protected ServerSocket |
createServerSocket(int port,
int backlog,
InetAddress whichNic)
Create a new
ServerSocket . |
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
int |
getPort()
Return the port this server is listening on.
|
protected ServerSocket |
getServerSocket() |
SocketAddress |
getServerSocketAddress()
Return the
SocketAddress that the underlying ServerSocket
is bound to. |
protected TcpSocketFactorySupport |
getTcpSocketFactorySupport() |
void |
run()
If no listener registers, exits.
|
void |
setTcpSocketFactorySupport(TcpSocketFactorySupport tcpSocketFactorySupport) |
void |
stop()
Stops the server.
|
afterShutdown, beforeShutdown, getBacklog, getConnection, getLocalAddress, initializeConnection, isListening, isLongLived, isShuttingDown, postProcessServerSocket, publishServerExceptionEvent, setBacklog, setListening, setLocalAddress, start
addConnection, checkActive, closeConnection, delayRead, doAccept, getApplicationEventPublisher, getDelayedReads, getDeserializer, getHost, getListener, getMapper, getOpenConnectionIds, getPhase, getReadDelay, getSender, getSerializer, getSoLinger, getSoReceiveBufferSize, getSoSendBufferSize, getSoTimeout, getSoTrafficClass, getTaskExecutor, getTcpSocketSupport, harvestClosedConnections, isActive, isAutoStartup, isLookupHost, isRunning, isSingleUse, isSoKeepAlive, isSoTcpNoDelay, onInit, processNioSelections, registerListener, registerSender, setActive, setApplicationEventPublisher, setDeserializer, setInterceptorFactoryChain, setLookupHost, setMapper, setNioHarvestInterval, setReadDelay, setSerializer, setSingleUse, setSocketAttributes, setSoKeepAlive, setSoLinger, setSoReceiveBufferSize, setSoSendBufferSize, setSoTcpNoDelay, setSoTimeout, setSoTrafficClass, setTaskExecutor, setTcpSocketSupport, stop, toString, wrapConnection
afterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setTaskScheduler
public TcpNetServerConnectionFactory(int port)
port
- The port.public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class IntegrationObjectSupport
public int getPort()
TcpServerConnectionFactory
getPort
in interface TcpServerConnectionFactory
getPort
in class AbstractConnectionFactory
public SocketAddress getServerSocketAddress()
TcpServerConnectionFactory
SocketAddress
that the underlying ServerSocket
is bound to.getServerSocketAddress
in interface TcpServerConnectionFactory
getServerSocketAddress
in class AbstractServerConnectionFactory
public 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 ServerSocket createServerSocket(int port, int backlog, InetAddress whichNic) throws IOException
ServerSocket
. This default implementation uses the default
ServerSocketFactory
. Override to use some other mechanismport
- The port.backlog
- The server socket backlog.whichNic
- An InetAddress if binding to a specific network interface. Set to
null when configured to bind to all interfaces.IOException
- Any IOException.public void stop()
AbstractConnectionFactory
stop
in interface Lifecycle
stop
in class AbstractConnectionFactory
protected ServerSocket getServerSocket()
protected TcpSocketFactorySupport getTcpSocketFactorySupport()
public void setTcpSocketFactorySupport(TcpSocketFactorySupport tcpSocketFactorySupport)