public abstract class TcpConnectionInterceptorSupport extends TcpConnectionSupport implements TcpConnectionInterceptor
TcpConnection.logger| Constructor and Description |
|---|
TcpConnectionInterceptorSupport() |
TcpConnectionInterceptorSupport(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) |
| Modifier and Type | Method and Description |
|---|---|
void |
addNewConnection(TcpConnection connection)
When we are using sockets owned by a
TcpListener, this
method is called each time a new connection is made. |
void |
close()
Closes this connection.
|
java.lang.String |
getConnectionId() |
org.springframework.core.serializer.Deserializer<?> |
getDeserializer() |
java.lang.Object |
getDeserializerStateKey() |
java.lang.String |
getHostAddress() |
java.lang.String |
getHostName() |
TcpListener |
getListener() |
java.lang.Object |
getPayload()
Uses the deserializer to obtain the message payload
from the connection's input stream.
|
int |
getPort() |
TcpSender |
getSender() |
org.springframework.core.serializer.Serializer<?> |
getSerializer() |
TcpConnectionSupport |
getTheConnection()
Returns the underlying connection (or next interceptor)
|
protected boolean |
hasRealSender() |
long |
incrementAndGetConnectionSequence() |
boolean |
isOpen() |
boolean |
isServer() |
boolean |
isSingleUse() |
boolean |
onMessage(org.springframework.messaging.Message<?> message)
Called by a TCPConnection when a new message arrives.
|
void |
registerListener(TcpListener listener)
Sets the listener that will receive incoming Messages.
|
void |
registerSender(TcpSender sender)
Registers a sender.
|
void |
removeDeadConnection(TcpConnection connection)
When we are using sockets owned by a
TcpListener, this
method is called each time a connection is closed. |
void |
run() |
void |
send(org.springframework.messaging.Message<?> message)
Converts and sends the message.
|
void |
setDeserializer(org.springframework.core.serializer.Deserializer<?> deserializer) |
void |
setMapper(TcpMessageMapper mapper) |
void |
setSerializer(org.springframework.core.serializer.Serializer<?> serializer) |
void |
setSingleUse(boolean singleUse) |
void |
setTheConnection(TcpConnectionSupport theConnection)
Sets the underlying connection (or next interceptor)
|
afterSend, closeConnection, getMapper, isNoReadErrorOnClose, publishConnectionCloseEvent, publishConnectionExceptionEvent, publishConnectionOpenEvent, publishEvent, sendExceptionToListener, setNoReadErrorOnClosepublic TcpConnectionInterceptorSupport()
public TcpConnectionInterceptorSupport(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
public void close()
TcpConnectionSupportclose in interface TcpConnectionclose in class TcpConnectionSupportpublic boolean isOpen()
isOpen in interface TcpConnectionpublic java.lang.Object getPayload()
throws java.lang.Exception
TcpConnectiongetPayload in interface TcpConnectionjava.lang.Exceptionpublic java.lang.String getHostName()
getHostName in interface TcpConnectiongetHostName in class TcpConnectionSupportpublic java.lang.String getHostAddress()
getHostAddress in interface TcpConnectiongetHostAddress in class TcpConnectionSupportpublic int getPort()
getPort in interface TcpConnectionpublic java.lang.Object getDeserializerStateKey()
getDeserializerStateKey in interface TcpConnectionDeserializer that
maintains state for this connection. Currently, this would be the InputStream
associated with the connection, but the object should be treated as opaque
and ONLY used as a key.public void registerListener(TcpListener listener)
TcpConnectionSupportregisterListener in class TcpConnectionSupportlistener - The listener.public void registerSender(TcpSender sender)
TcpConnectionSupportregisterSender in class TcpConnectionSupportsender - the sender.public java.lang.String getConnectionId()
getConnectionId in interface TcpConnectiongetConnectionId in class TcpConnectionSupportpublic boolean isSingleUse()
isSingleUse in interface TcpConnectionisSingleUse in class TcpConnectionSupportpublic void run()
run in interface java.lang.Runnablepublic void setSingleUse(boolean singleUse)
setSingleUse in class TcpConnectionSupportsingleUse - true if this socket is to used once and
discarded.public void setMapper(TcpMessageMapper mapper)
setMapper in class TcpConnectionSupportmapper - the mapper to setpublic org.springframework.core.serializer.Deserializer<?> getDeserializer()
getDeserializer in interface TcpConnectiongetDeserializer in class TcpConnectionSupportpublic void setDeserializer(org.springframework.core.serializer.Deserializer<?> deserializer)
setDeserializer in class TcpConnectionSupportdeserializer - the deserializer to setpublic org.springframework.core.serializer.Serializer<?> getSerializer()
getSerializer in interface TcpConnectiongetSerializer in class TcpConnectionSupportpublic void setSerializer(org.springframework.core.serializer.Serializer<?> serializer)
setSerializer in class TcpConnectionSupportserializer - the serializer to setpublic boolean isServer()
isServer in interface TcpConnectionisServer in class TcpConnectionSupportpublic boolean onMessage(org.springframework.messaging.Message<?> message)
TcpListeneronMessage in interface TcpListenermessage - The message.public void send(org.springframework.messaging.Message<?> message)
throws java.lang.Exception
TcpConnectionsend in interface TcpConnectionmessage - The messagejava.lang.Exceptionpublic TcpConnectionSupport getTheConnection()
public void setTheConnection(TcpConnectionSupport theConnection)
theConnection - the connectionpublic TcpListener getListener()
getListener in interface TcpConnectiongetListener in class TcpConnectionSupportpublic void addNewConnection(TcpConnection connection)
TcpSenderTcpListener, this
method is called each time a new connection is made.addNewConnection in interface TcpSenderconnection - The connection.public void removeDeadConnection(TcpConnection connection)
TcpSenderTcpListener, this
method is called each time a connection is closed.removeDeadConnection in interface TcpSenderconnection - The connection.public long incrementAndGetConnectionSequence()
incrementAndGetConnectionSequence in interface TcpConnectionincrementAndGetConnectionSequence in class TcpConnectionSupportpublic TcpSender getSender()
getSender in class TcpConnectionSupportprotected boolean hasRealSender()