public class SocketOptionPlugin<T> extends AbstractPlugin<T>
| Constructor and Description |
|---|
SocketOptionPlugin() |
| Modifier and Type | Method and Description |
|---|---|
<V> V |
getOption(SocketOption<V> socketOption) |
void |
setOption(AsynchronousSocketChannel channel)
往socket channel中设置option值。
默认将通过
setOption(SocketOption, Object)指定的配置值绑定到每一个Socket中。
如果有个性化的需求,可以重新实现本方法。 |
<V> SocketOptionPlugin<T> |
setOption(SocketOption<V> socketOption,
V value)
设置Socket的TCP参数配置。
|
AsynchronousSocketChannel |
shouldAccept(AsynchronousSocketChannel channel)
监控已接收到的连接
|
afterRead, afterWrite, beforeRead, beforeWrite, preProcess, stateEventpublic final AsynchronousSocketChannel shouldAccept(AsynchronousSocketChannel channel)
NetMonitorshouldAccept in interface NetMonitorshouldAccept in class AbstractPlugin<T>channel - 当前已经建立连接的通道对象public void setOption(AsynchronousSocketChannel channel)
setOption(SocketOption, Object)指定的配置值绑定到每一个Socket中。
如果有个性化的需求,可以重新实现本方法。channel - 频道public final <V> SocketOptionPlugin<T> setOption(SocketOption<V> socketOption, V value)
AIO客户端的有效可选范围为: 1. StandardSocketOptions.SO_SNDBUF 2. StandardSocketOptions.SO_RCVBUF 3. StandardSocketOptions.SO_KEEPALIVE 4. StandardSocketOptions.SO_REUSEADDR 5. StandardSocketOptions.TCP_NODELAY
V - 泛型socketOption - 配置项value - 配置值public final <V> V getOption(SocketOption<V> socketOption)
Copyright © 2021. All rights reserved.