public abstract class TcpConnectionInterceptorSupport extends TcpConnectionSupport implements TcpConnectionInterceptor
TcpConnection.logger| Constructor and Description |
|---|
TcpConnectionInterceptorSupport() |
TcpConnectionInterceptorSupport(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.
|
String |
getConnectionFactoryName() |
String |
getConnectionId() |
Deserializer<?> |
getDeserializer() |
Object |
getDeserializerStateKey() |
String |
getHostAddress() |
String |
getHostName() |
TcpListener |
getListener() |
Object |
getPayload()
Uses the deserializer to obtain the message payload
from the connection's input stream.
|
int |
getPort() |
TcpSender |
getSender() |
Serializer<?> |
getSerializer() |
SocketInfo |
getSocketInfo()
Provides getters for
Socket properties. |
SSLSession |
getSslSession() |
TcpConnectionSupport |
getTheConnection()
Returns the underlying connection (or next interceptor)
|
protected boolean |
hasRealSender() |
long |
incrementAndGetConnectionSequence() |
boolean |
isOpen() |
boolean |
isServer() |
boolean |
onMessage(Message<?> message)
Called by a TCPConnection when a new message arrives.
|
void |
registerListener(TcpListener listener)
Set 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(Message<?> message)
Converts and sends the message.
|
void |
setDeserializer(Deserializer<?> deserializer) |
void |
setMapper(TcpMessageMapper mapper) |
void |
setSerializer(Serializer<?> serializer) |
void |
setTheConnection(TcpConnectionSupport theConnection)
Sets the underlying connection (or next interceptor)
|
closeConnection, enableManualListenerRegistration, getMapper, isNoReadErrorOnClose, publishConnectionCloseEvent, publishConnectionExceptionEvent, publishConnectionOpenEvent, publishEvent, sendExceptionToListener, setNoReadErrorOnClose, toStringpublic TcpConnectionInterceptorSupport()
public TcpConnectionInterceptorSupport(ApplicationEventPublisher applicationEventPublisher)
public void close()
TcpConnectionSupportclose in interface TcpConnectionclose in class TcpConnectionSupportpublic boolean isOpen()
isOpen in interface TcpConnectionpublic Object getPayload()
TcpConnectiongetPayload in interface TcpConnectionpublic String getHostName()
getHostName in interface TcpConnectiongetHostName in class TcpConnectionSupportpublic String getHostAddress()
getHostAddress in interface TcpConnectiongetHostAddress in class TcpConnectionSupportpublic int getPort()
getPort in interface TcpConnectionpublic 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 String getConnectionId()
getConnectionId in interface TcpConnectiongetConnectionId in class TcpConnectionSupportpublic SocketInfo getSocketInfo()
TcpConnectionSocket properties.getSocketInfo in interface TcpConnectiongetSocketInfo in class TcpConnectionSupportpublic String getConnectionFactoryName()
getConnectionFactoryName in class TcpConnectionSupportpublic void setMapper(TcpMessageMapper mapper)
setMapper in class TcpConnectionSupportmapper - the mapper to setpublic Deserializer<?> getDeserializer()
getDeserializer in interface TcpConnectiongetDeserializer in class TcpConnectionSupportpublic void setDeserializer(Deserializer<?> deserializer)
setDeserializer in class TcpConnectionSupportdeserializer - the deserializer to setpublic Serializer<?> getSerializer()
getSerializer in interface TcpConnectiongetSerializer in class TcpConnectionSupportpublic void setSerializer(Serializer<?> serializer)
setSerializer in class TcpConnectionSupportserializer - the serializer to setpublic boolean isServer()
isServer in interface TcpConnectionisServer in class TcpConnectionSupportpublic SSLSession getSslSession()
getSslSession in interface TcpConnectionSSLSession associated with this connection, if SSL is in use,
null otherwise.public boolean onMessage(Message<?> message)
TcpListeneronMessage in interface TcpListenermessage - The message.public void send(Message<?> message)
TcpConnectionsend in interface TcpConnectionmessage - The message,public 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()