Class AbstractPlugin<T>

java.lang.Object
org.aoju.bus.socket.plugins.AbstractPlugin<T>
All Implemented Interfaces:
NetMonitor, Plugin<T>
Direct Known Subclasses:
BlackListPlugin, HeartPlugin, MonitorPlugin, PageBufferPlugin, RateLimiterPlugin, ReconnectPlugin, SocketOptionPlugin, SslPlugin, StreamMonitorPlugin

public abstract class AbstractPlugin<T> extends Object implements Plugin<T>
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • AbstractPlugin

      public AbstractPlugin()
  • Method Details

    • preProcess

      public boolean preProcess(AioSession session, T t)
      Description copied from interface: Plugin
      对请求消息进行预处理,并决策是否进行后续的MessageProcessor处理 若返回false,则当前消息将被忽略 若返回true,该消息会正常秩序MessageProcessor.process.
      Specified by:
      preProcess in interface Plugin<T>
      Parameters:
      session - 会话
      t - 对象
      Returns:
      the true/false
    • stateEvent

      public void stateEvent(SocketStatus socketStatus, AioSession session, Throwable throwable)
      Description copied from interface: Plugin
      监听状态机事件
      Specified by:
      stateEvent in interface Plugin<T>
      Parameters:
      socketStatus - 状态
      session - 会话
      throwable - 线程
      See Also:
    • shouldAccept

      Description copied from interface: NetMonitor
      监控已接收到的连接
      Specified by:
      shouldAccept in interface NetMonitor
      Parameters:
      channel - 当前已经建立连接的通道对象
      Returns:
      非null:接受该连接,null:拒绝该连接
    • afterRead

      public void afterRead(AioSession session, int readSize)
      Description copied from interface: NetMonitor
      监控触发本次读回调Session的已读数据字节数
      Specified by:
      afterRead in interface NetMonitor
      Parameters:
      session - 当前执行read的AioSession对象
      readSize - 已读数据长度
    • afterWrite

      public void afterWrite(AioSession session, int writeSize)
      Description copied from interface: NetMonitor
      监控触发本次写回调session的已写数据字节数
      Specified by:
      afterWrite in interface NetMonitor
      Parameters:
      session - 本次执行write回调的AIOSession对象
      writeSize - 本次输出的数据长度
    • beforeRead

      public void beforeRead(AioSession session)
      Description copied from interface: NetMonitor
      即将开始读取数据
      Specified by:
      beforeRead in interface NetMonitor
      Parameters:
      session - 当前会话对象
    • beforeWrite

      public void beforeWrite(AioSession session)
      Description copied from interface: NetMonitor
      即将开始写数据
      Specified by:
      beforeWrite in interface NetMonitor
      Parameters:
      session - 当前会话对象