public abstract class AbstractProcessor<T> extends Object implements MessageProcessor<T>, NetMonitor
| Constructor and Description |
|---|
AbstractProcessor() |
| Modifier and Type | Method and Description |
|---|---|
void |
addPlugin(Plugin<T> plugin) |
void |
afterRead(AioSession session,
int readSize)
监控触发本次读回调Session的已读数据字节数
|
void |
afterWrite(AioSession session,
int writeSize)
监控触发本次写回调session的已写数据字节数
|
void |
beforeRead(AioSession session)
即将开始读取数据
|
void |
beforeWrite(AioSession session)
即将开始写数据
|
void |
process(AioSession session,
T msg)
处理接收到的消息
|
abstract void |
process0(AioSession session,
T msg)
处理接收到的消息
|
AsynchronousSocketChannel |
shouldAccept(AsynchronousSocketChannel channel)
监控已接收到的连接
|
void |
stateEvent(AioSession session,
SocketStatus socketStatus,
Throwable throwable)
状态机事件,当枚举事件发生时由框架触发该方法
|
abstract void |
stateEvent0(AioSession session,
SocketStatus socketStatus,
Throwable throwable) |
public final void afterRead(AioSession session, int readSize)
NetMonitorafterRead in interface NetMonitorsession - 当前执行read的AioSession对象readSize - 已读数据长度public final void afterWrite(AioSession session, int writeSize)
NetMonitorafterWrite in interface NetMonitorsession - 本次执行write回调的AIOSession对象writeSize - 本次输出的数据长度public final void beforeRead(AioSession session)
NetMonitorbeforeRead in interface NetMonitorsession - 当前会话对象public final void beforeWrite(AioSession session)
NetMonitorbeforeWrite in interface NetMonitorsession - 当前会话对象public final AsynchronousSocketChannel shouldAccept(AsynchronousSocketChannel channel)
NetMonitorshouldAccept in interface NetMonitorchannel - 当前已经建立连接的通道对象public final void process(AioSession session, T msg)
MessageProcessorprocess in interface MessageProcessor<T>session - 通信会话msg - 待处理的业务消息public abstract void process0(AioSession session, T msg)
session - 会话msg - 消息MessageProcessor.process(AioSession, Object)public final void stateEvent(AioSession session, SocketStatus socketStatus, Throwable throwable)
MessageProcessorstateEvent in interface MessageProcessor<T>session - 本次触发状态机的AioSession对象socketStatus - 状态枚举throwable - 异常对象,如果存在的话SocketStatuspublic abstract void stateEvent0(AioSession session, SocketStatus socketStatus, Throwable throwable)
session - 会话socketStatus - 状态throwable - 线程stateEvent(AioSession, SocketStatus, Throwable)Copyright © 2021. All rights reserved.