java.lang.Object
org.miaixz.bus.socket.plugin.AbstractPlugin<T>
- Direct Known Subclasses:
BlackListPlugin,BufferPageMonitorPlugin,HeartPlugin,IdleStatePlugin,MonitorPlugin,RateLimiterPlugin,SocketOptionPlugin,SslPlugin,StreamMonitorPlugin
抽象插件
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid监控触发本次读回调Session的已读数据字节数voidafterWrite(Session session, int writeSize) 监控触发本次写回调session的已写数据字节数voidbeforeRead(Session session) 即将开始读取数据voidbeforeWrite(Session session) 即将开始写数据boolean对请求消息进行预处理,并决策是否进行后续的Handler处理 若返回false,则当前消息将被忽略。shouldAccept(AsynchronousSocketChannel channel) 监控已接收到的连接voidstateEvent(Status status, Session session, Throwable throwable) 监听状态机事件static StringtoHex(byte b) 将字节转换成16进制显示static StringtoHexString(byte[] bytes) 以16进制 打印字节数组
-
Constructor Details
-
AbstractPlugin
public AbstractPlugin()
-
-
Method Details
-
toHex
将字节转换成16进制显示- Parameters:
b- byte- Returns:
- String
-
toHexString
以16进制 打印字节数组- Parameters:
bytes- byte[]
-
process
Description copied from interface:Plugin对请求消息进行预处理,并决策是否进行后续的Handler处理 若返回false,则当前消息将被忽略。 若返回true,该消息会正常秩序Handler.process -
stateEvent
Description copied from interface:Plugin监听状态机事件- Specified by:
stateEventin interfacePlugin<T>- Parameters:
status- 状态session- 会话throwable- 异常- See Also:
-
shouldAccept
Description copied from interface:Monitor监控已接收到的连接- Specified by:
shouldAcceptin interfaceMonitor- Parameters:
channel- 当前已经建立连接的通道对象- Returns:
- 非null:接受该连接,null:拒绝该连接
-
afterRead
Description copied from interface:Monitor监控触发本次读回调Session的已读数据字节数 -
afterWrite
Description copied from interface:Monitor监控触发本次写回调session的已写数据字节数- Specified by:
afterWritein interfaceMonitor- Parameters:
session- 本次执行write回调的Session对象writeSize- 本次输出的数据长度
-
beforeRead
Description copied from interface:Monitor即将开始读取数据- Specified by:
beforeReadin interfaceMonitor- Parameters:
session- 当前会话对象
-
beforeWrite
Description copied from interface:Monitor即将开始写数据- Specified by:
beforeWritein interfaceMonitor- Parameters:
session- 当前会话对象
-