P - the payload type of messages read or written to the TCP stream.public class Reactor2TcpConnection<P> extends 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<Void> closePromise) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the connection.
|
void |
onReadInactivity(Runnable runnable,
long inactivityDuration)
Register a task to invoke after a period of of read inactivity.
|
void |
onWriteInactivity(Runnable runnable,
long inactivityDuration)
Register a task to invoke after a period of of write inactivity.
|
ListenableFuture<Void> |
send(Message<P> message)
Send the given message.
|
public ListenableFuture<Void> send(Message<P> message)
TcpConnectionsend in interface TcpConnection<P>message - the messagepublic void onReadInactivity(Runnable runnable, long inactivityDuration)
TcpConnectiononReadInactivity in interface TcpConnection<P>runnable - the task to invokeinactivityDuration - the amount of inactive time in millisecondspublic void onWriteInactivity(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 Closeableclose in interface AutoCloseableclose in interface TcpConnection<P>