P - the payload type of messages read or written to the TCP stream.public class Reactor2TcpConnection<P> extends java.lang.Object implements TcpConnection<P>
TcpConnection based on the TCP client support of the Reactor project.| Constructor and Description |
|---|
Reactor2TcpConnection(reactor.io.net.ChannelStream<Message<P>,Message<P>> channelStream,
reactor.rx.Promise<java.lang.Void> closePromise) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the connection.
|
void |
onReadInactivity(java.lang.Runnable runnable,
long inactivityDuration)
Register a task to invoke after a period of read inactivity.
|
void |
onWriteInactivity(java.lang.Runnable runnable,
long inactivityDuration)
Register a task to invoke after a period of write inactivity.
|
ListenableFuture<java.lang.Void> |
send(Message<P> message)
Send the given message.
|
public ListenableFuture<java.lang.Void> send(Message<P> message)
TcpConnectionsend in interface TcpConnection<P>message - the messagepublic void onReadInactivity(java.lang.Runnable runnable,
long inactivityDuration)
TcpConnectiononReadInactivity in interface TcpConnection<P>runnable - the task to invokeinactivityDuration - the amount of inactive time in millisecondspublic void onWriteInactivity(java.lang.Runnable runnable,
long inactivityDuration)
TcpConnectiononWriteInactivity in interface TcpConnection<P>runnable - the task to invokeinactivityDuration - the amount of inactive time in millisecondspublic void close()
TcpConnectionclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface TcpConnection<P>