public class TcpNetServerConnectionFactory extends AbstractServerConnectionFactory
TcpNetConnections using
a ServerSocket. Must have a TcpListener registered.DEFAULT_REPLY_TIMEOUT, lifecycleMonitor| Constructor and Description |
|---|
TcpNetServerConnectionFactory(int port)
Listens for incoming connections on the port.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.net.ServerSocket |
createServerSocket(int port,
int backlog,
java.net.InetAddress whichNic)
Create a new
ServerSocket. |
java.lang.String |
getComponentType() |
int |
getPort()
Return the port this server is listening on.
|
protected java.net.ServerSocket |
getServerSocket() |
java.net.SocketAddress |
getServerSocketAddress()
Return the
SocketAddress that the underlying ServerSocket
is bound to. |
protected TcpSocketFactorySupport |
getTcpSocketFactorySupport() |
void |
run()
If no listener registers, exits.
|
void |
setTcpNetConnectionSupport(TcpNetConnectionSupport connectionSupport)
Set the
TcpNetConnectionSupport to use to create connection objects. |
void |
setTcpSocketFactorySupport(TcpSocketFactorySupport tcpSocketFactorySupport) |
void |
stop()
Stops the server.
|
afterShutdown, beforeShutdown, getBacklog, getConnection, getLocalAddress, initializeConnection, isListening, isLongLived, isShuttingDown, postProcessServerSocket, publishServerExceptionEvent, publishServerListeningEvent, setBacklog, setListening, setLocalAddress, startaddConnection, checkActive, closeConnection, delayRead, doAccept, 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, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskSchedulerpublic TcpNetServerConnectionFactory(int port)
port - The port.public java.lang.String getComponentType()
getComponentType in interface org.springframework.integration.support.context.NamedComponentgetComponentType in class org.springframework.integration.context.IntegrationObjectSupportpublic int getPort()
TcpServerConnectionFactorygetPort in interface TcpServerConnectionFactorygetPort in class AbstractConnectionFactorypublic java.net.SocketAddress getServerSocketAddress()
TcpServerConnectionFactorySocketAddress that the underlying ServerSocket
is bound to.getServerSocketAddress in interface TcpServerConnectionFactorygetServerSocketAddress in class AbstractServerConnectionFactorypublic void setTcpNetConnectionSupport(TcpNetConnectionSupport connectionSupport)
TcpNetConnectionSupport to use to create connection objects.connectionSupport - the connection support.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 java.net.ServerSocket createServerSocket(int port,
int backlog,
java.net.InetAddress whichNic)
throws java.io.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.java.io.IOException - Any IOException.public void stop()
AbstractConnectionFactorystop in interface org.springframework.context.Lifecyclestop in class AbstractConnectionFactoryprotected java.net.ServerSocket getServerSocket()
protected TcpSocketFactorySupport getTcpSocketFactorySupport()
public void setTcpSocketFactorySupport(TcpSocketFactorySupport tcpSocketFactorySupport)