|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
public abstract class AbstractConnectionFactory
Base class for all connection factories.
Field Summary | |
---|---|
protected static int |
DEFAULT_REPLY_TIMEOUT
|
protected java.lang.Object |
lifecycleMonitor
|
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport |
---|
logger |
Constructor Summary | |
---|---|
AbstractConnectionFactory(int port)
|
|
AbstractConnectionFactory(java.lang.String host,
int port)
|
Method Summary | |
---|---|
protected void |
addConnection(TcpConnection connection)
|
protected void |
checkActive()
|
abstract void |
close()
Closes the server. |
protected void |
doAccept(java.nio.channels.Selector selector,
java.nio.channels.ServerSocketChannel server,
long now)
|
org.springframework.core.serializer.Deserializer<?> |
getDeserializer()
|
java.lang.String |
getHost()
|
TcpListener |
getListener()
|
TcpMessageMapper |
getMapper()
|
int |
getPhase()
|
int |
getPoolSize()
|
int |
getPort()
|
TcpSender |
getSender()
|
org.springframework.core.serializer.Serializer<?> |
getSerializer()
|
int |
getSoLinger()
|
int |
getSoReceiveBufferSize()
|
int |
getSoSendBufferSize()
|
int |
getSoTimeout()
|
int |
getSoTrafficClass()
|
protected java.util.concurrent.Executor |
getTaskExecutor()
Creates a taskExecutor (if one was not provided). |
protected void |
harvestClosedConnections()
|
protected boolean |
isActive()
|
boolean |
isAutoStartup()
We are controlled by the startup options of the bound endpoint. |
boolean |
isLookupHost()
|
boolean |
isRunning()
|
boolean |
isSingleUse()
|
boolean |
isSoKeepAlive()
|
boolean |
isSoTcpNoDelay()
|
protected void |
processNioSelections(int selectionCount,
java.nio.channels.Selector selector,
java.nio.channels.ServerSocketChannel server,
java.util.Map<java.nio.channels.SocketChannel,TcpNioConnection> connections)
Times out any expired connections then, if selectionCount > 0, processes the selected keys. |
void |
registerListener(TcpListener listener)
Registers a TcpListener to receive messages after the payload has been converted from the input data. |
void |
registerSender(TcpSender sender)
Registers a TcpSender; for server sockets, used to provide connection information so a sender can be used to reply to incoming messages. |
protected void |
setActive(boolean active)
|
void |
setDeserializer(org.springframework.core.serializer.Deserializer<?> deserializer)
|
void |
setInterceptorFactoryChain(TcpConnectionInterceptorFactoryChain interceptorFactoryChain)
|
void |
setLookupHost(boolean lookupHost)
If true, DNS reverse lookup is done on the remote ip address. |
void |
setMapper(TcpMessageMapper mapper)
|
void |
setPoolSize(int poolSize)
|
void |
setSerializer(org.springframework.core.serializer.Serializer<?> serializer)
|
void |
setSingleUse(boolean singleUse)
If true, sockets created by this factory will be used once. |
protected void |
setSocketAttributes(java.net.Socket socket)
Sets socket attributes on the socket. |
void |
setSoKeepAlive(boolean soKeepAlive)
|
void |
setSoLinger(int soLinger)
|
void |
setSoReceiveBufferSize(int soReceiveBufferSize)
|
void |
setSoSendBufferSize(int soSendBufferSize)
|
void |
setSoTcpNoDelay(boolean soTcpNoDelay)
|
void |
setSoTimeout(int soTimeout)
|
void |
setSoTrafficClass(int soTrafficClass)
|
void |
setTaskExecutor(java.util.concurrent.Executor taskExecutor)
|
void |
start()
Starts the listening process. |
void |
stop()
Stops the server. |
void |
stop(java.lang.Runnable callback)
|
protected TcpConnection |
wrapConnection(TcpConnection connection)
|
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
---|
afterPropertiesSet, getBeanFactory, getComponentName, getComponentType, getConversionService, getTaskScheduler, onInit, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.springframework.integration.ip.tcp.connection.ConnectionFactory |
---|
getConnection |
Methods inherited from interface java.lang.Runnable |
---|
run |
Field Detail |
---|
protected static final int DEFAULT_REPLY_TIMEOUT
protected final java.lang.Object lifecycleMonitor
Constructor Detail |
---|
public AbstractConnectionFactory(int port)
public AbstractConnectionFactory(java.lang.String host, int port)
Method Detail |
---|
protected void setSocketAttributes(java.net.Socket socket) throws java.net.SocketException
socket
- The socket.
java.net.SocketException
public int getSoTimeout()
public void setSoTimeout(int soTimeout)
soTimeout
- the soTimeout to setpublic int getSoReceiveBufferSize()
public void setSoReceiveBufferSize(int soReceiveBufferSize)
soReceiveBufferSize
- the soReceiveBufferSize to setpublic int getSoSendBufferSize()
public void setSoSendBufferSize(int soSendBufferSize)
soSendBufferSize
- the soSendBufferSize to setpublic boolean isSoTcpNoDelay()
public void setSoTcpNoDelay(boolean soTcpNoDelay)
soTcpNoDelay
- the soTcpNoDelay to setpublic int getSoLinger()
public void setSoLinger(int soLinger)
soLinger
- the soLinger to setpublic boolean isSoKeepAlive()
public void setSoKeepAlive(boolean soKeepAlive)
soKeepAlive
- the soKeepAlive to setpublic int getSoTrafficClass()
public void setSoTrafficClass(int soTrafficClass)
soTrafficClass
- the soTrafficClass to setpublic java.lang.String getHost()
public int getPort()
public TcpListener getListener()
public TcpSender getSender()
public org.springframework.core.serializer.Serializer<?> getSerializer()
public org.springframework.core.serializer.Deserializer<?> getDeserializer()
public TcpMessageMapper getMapper()
public int getPoolSize()
public void registerListener(TcpListener listener)
listener
- the TcpListener.public void registerSender(TcpSender sender)
sender
- The senderpublic void setTaskExecutor(java.util.concurrent.Executor taskExecutor)
taskExecutor
- the taskExecutor to setpublic void setDeserializer(org.springframework.core.serializer.Deserializer<?> deserializer)
deserializer
- the deserializer to setpublic void setSerializer(org.springframework.core.serializer.Serializer<?> serializer)
serializer
- the serializer to setpublic void setMapper(TcpMessageMapper mapper)
mapper
- the mapper to set; defaults to a TcpMessageMapper
public boolean isSingleUse()
public void setSingleUse(boolean singleUse)
singleUse
- public void setPoolSize(int poolSize)
public void setInterceptorFactoryChain(TcpConnectionInterceptorFactoryChain interceptorFactoryChain)
public void setLookupHost(boolean lookupHost)
lookupHost
- the lookupHost to setpublic boolean isLookupHost()
public abstract void close()
public void start()
start
in interface org.springframework.context.Lifecycle
protected java.util.concurrent.Executor getTaskExecutor()
public void stop()
stop
in interface org.springframework.context.Lifecycle
protected TcpConnection wrapConnection(TcpConnection connection) throws java.lang.Exception
java.lang.Exception
protected void processNioSelections(int selectionCount, java.nio.channels.Selector selector, java.nio.channels.ServerSocketChannel server, java.util.Map<java.nio.channels.SocketChannel,TcpNioConnection> connections) throws java.io.IOException
selectionCount
- selector
- connections
-
java.io.IOException
protected void doAccept(java.nio.channels.Selector selector, java.nio.channels.ServerSocketChannel server, long now) throws java.io.IOException
selector
- now
-
java.io.IOException
public int getPhase()
getPhase
in interface org.springframework.context.Phased
public boolean isAutoStartup()
isAutoStartup
in interface org.springframework.context.SmartLifecycle
public void stop(java.lang.Runnable callback)
stop
in interface org.springframework.context.SmartLifecycle
protected void addConnection(TcpConnection connection)
protected void harvestClosedConnections()
public boolean isRunning()
isRunning
in interface org.springframework.context.Lifecycle
protected boolean isActive()
protected void setActive(boolean active)
active
- the active to setprotected void checkActive() throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |