Package org.aoju.bus.socket.process
Class AbstractProcessor<T>
java.lang.Object
org.aoju.bus.socket.process.AbstractProcessor<T>
- All Implemented Interfaces:
NetMonitor,MessageProcessor<T>
public abstract class AbstractProcessor<T>
extends Object
implements MessageProcessor<T>, NetMonitor
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidfinal voidafterRead(AioSession session, int readSize) 监控触发本次读回调Session的已读数据字节数final voidafterWrite(AioSession session, int writeSize) 监控触发本次写回调session的已写数据字节数final voidbeforeRead(AioSession session) 即将开始读取数据final voidbeforeWrite(AioSession session) 即将开始写数据final voidprocess(AioSession session, T msg) 处理接收到的消息abstract voidprocess0(AioSession session, T msg) 处理接收到的消息shouldAccept(AsynchronousSocketChannel channel) 监控已接收到的连接final voidstateEvent(AioSession session, SocketStatus socketStatus, Throwable throwable) 状态机事件,当枚举事件发生时由框架触发该方法abstract voidstateEvent0(AioSession session, SocketStatus socketStatus, Throwable throwable)
-
Constructor Details
-
AbstractProcessor
public AbstractProcessor()
-
-
Method Details
-
afterRead
Description copied from interface:NetMonitor监控触发本次读回调Session的已读数据字节数- Specified by:
afterReadin interfaceNetMonitor- Parameters:
session- 当前执行read的AioSession对象readSize- 已读数据长度
-
afterWrite
Description copied from interface:NetMonitor监控触发本次写回调session的已写数据字节数- Specified by:
afterWritein interfaceNetMonitor- Parameters:
session- 本次执行write回调的AIOSession对象writeSize- 本次输出的数据长度
-
beforeRead
Description copied from interface:NetMonitor即将开始读取数据- Specified by:
beforeReadin interfaceNetMonitor- Parameters:
session- 当前会话对象
-
beforeWrite
Description copied from interface:NetMonitor即将开始写数据- Specified by:
beforeWritein interfaceNetMonitor- Parameters:
session- 当前会话对象
-
shouldAccept
Description copied from interface:NetMonitor监控已接收到的连接- Specified by:
shouldAcceptin interfaceNetMonitor- Parameters:
channel- 当前已经建立连接的通道对象- Returns:
- 非null:接受该连接,null:拒绝该连接
-
process
Description copied from interface:MessageProcessor处理接收到的消息- Specified by:
processin interfaceMessageProcessor<T>- Parameters:
session- 通信会话msg- 待处理的业务消息
-
process0
处理接收到的消息- Parameters:
session- 会话msg- 消息- See Also:
-
stateEvent
Description copied from interface:MessageProcessor状态机事件,当枚举事件发生时由框架触发该方法- Specified by:
stateEventin interfaceMessageProcessor<T>- Parameters:
session- 本次触发状态机的AioSession对象socketStatus- 状态枚举throwable- 异常对象,如果存在的话- See Also:
-
stateEvent0
public abstract void stateEvent0(AioSession session, SocketStatus socketStatus, Throwable throwable) - Parameters:
session- 会话socketStatus- 状态throwable- 线程- See Also:
-
addPlugin
-