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)
TcpConnection
send
in interface TcpConnection<P>
message
- the messagepublic void onReadInactivity(Runnable runnable, long inactivityDuration)
TcpConnection
onReadInactivity
in interface TcpConnection<P>
runnable
- the task to invokeinactivityDuration
- the amount of inactive time in millisecondspublic void onWriteInactivity(Runnable runnable, long inactivityDuration)
TcpConnection
onWriteInactivity
in interface TcpConnection<P>
runnable
- the task to invokeinactivityDuration
- the amount of inactive time in millisecondspublic void close()
TcpConnection
close
in interface Closeable
close
in interface AutoCloseable
close
in interface TcpConnection<P>