接口 TcpConnection<P>
- 类型参数:
P
- the type of payload for outboundMessage
s
- 所有超级接口:
AutoCloseable
,Closeable
- 所有已知实现类:
Reactor2TcpConnection
public interface TcpConnection<P> extends Closeable
A contract for sending messages and managing a TCP connection.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 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.
方法详细资料
send
ListenableFuture<Void> send(Message<P> message)
Send the given message.- 参数:
message
- the message- 返回:
- a ListenableFuture that can be used to determine when and if the message was successfully sent
onReadInactivity
void onReadInactivity(Runnable runnable, long duration)
Register a task to invoke after a period of read inactivity.- 参数:
runnable
- the task to invokeduration
- the amount of inactive time in milliseconds
onWriteInactivity
void onWriteInactivity(Runnable runnable, long duration)
Register a task to invoke after a period of write inactivity.- 参数:
runnable
- the task to invokeduration
- the amount of inactive time in milliseconds
close
void close()
Close the connection.- 指定者:
close
在接口中AutoCloseable
- 指定者:
close
在接口中Closeable