Interface TcpConnection<P>
- Type Parameters:
- P- the type of payload for outbound- Messages
- All Superinterfaces:
- AutoCloseable,- Closeable
- All Known Implementing Classes:
- ReactorNetty2TcpConnection,- ReactorNettyTcpConnection
A contract for sending messages and managing a TCP connection.
- Since:
- 4.0
- Author:
- Rossen Stoyanchev
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Close the connection.voidonReadInactivity(Runnable runnable, long duration) Register a task to invoke after a period of read inactivity.voidonWriteInactivity(Runnable runnable, long duration) Register a task to invoke after a period of write inactivity.default ListenableFuture<Void>Deprecated.Send the given message.
- 
Method Details- 
sendDeprecated.as of 6.0, in favor ofsendAsync(Message)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
 
- 
sendAsyncSend the given message.- Parameters:
- message- the message
- Returns:
- a CompletableFuture that can be used to determine when and if the message was successfully sent
- Since:
- 6.0
 
- 
onReadInactivityRegister a task to invoke after a period of read inactivity.- Parameters:
- runnable- the task to invoke
- duration- the amount of inactive time in milliseconds
 
- 
onWriteInactivityRegister a task to invoke after a period of write inactivity.- Parameters:
- runnable- the task to invoke
- duration- the amount of inactive time in milliseconds
 
- 
closevoid close()Close the connection.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
 
- 
sendAsync(Message)