P
- the type of payload for outbound Messages
public interface TcpConnection<P> extends Closeable
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the connection.
|
void |
onReadInactivity(Runnable runnable,
long duration)
Register a task to invoke after a period of read inactivity.
|
void |
onWriteInactivity(Runnable runnable,
long duration)
Register a task to invoke after a period of write inactivity.
|
ListenableFuture<Void> |
send(Message<P> message)
Send the given message.
|
ListenableFuture<Void> send(Message<P> message)
message
- the messagevoid onReadInactivity(Runnable runnable, long duration)
runnable
- the task to invokeduration
- the amount of inactive time in millisecondsvoid onWriteInactivity(Runnable runnable, long duration)
runnable
- the task to invokeduration
- the amount of inactive time in millisecondsvoid close()
close
in interface AutoCloseable
close
in interface Closeable