Interface TcpConnection<P>
- Type Parameters:
P
- the type of payload for outboundMessages
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
ReactorNettyTcpConnection
A contract for sending messages and managing a TCP connection.
- Since:
- 4.0
- Author:
- Rossen Stoyanchev
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.Send the given message.
-
Method Details
-
send
Send the given message.- Parameters:
message
- the message- Returns:
- a ListenableFuture that can be used to determine when and if the message was successfully sent
-
onReadInactivity
Register a task to invoke after a period of read inactivity.- Parameters:
runnable
- the task to invokeduration
- the amount of inactive time in milliseconds
-
onWriteInactivity
Register a task to invoke after a period of write inactivity.- Parameters:
runnable
- the task to invokeduration
- the amount of inactive time in milliseconds
-
close
void close()Close the connection.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-