Class SocketProcessorBase<S>

  • Type Parameters:
    S - the type of the socket associated with the wrapper
    All Implemented Interfaces:
    java.lang.Runnable
    Direct Known Subclasses:
    Nio2Endpoint.SocketProcessor, NioEndpoint.SocketProcessor

    public abstract class SocketProcessorBase<S>
    extends java.lang.Object
    implements java.lang.Runnable
    Base class for socket processors that handle I/O events on a wrapped socket. Subclasses implement doRun() to define the processing logic.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected SocketEvent event
      The event that triggered this processor (e.g., READ, WRITE).
      protected SocketWrapperBase<S> socketWrapper
      The socket wrapper that provides access to the underlying socket and its state.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void doRun()
      Performs the actual socket processing work.
      void reset​(SocketWrapperBase<S> socketWrapper, SocketEvent event)
      Resets this processor with a new socket wrapper and event, allowing reuse.
      void run()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • socketWrapper

        protected SocketWrapperBase<S> socketWrapper
        The socket wrapper that provides access to the underlying socket and its state.
      • event

        protected SocketEvent event
        The event that triggered this processor (e.g., READ, WRITE).
    • Constructor Detail

      • SocketProcessorBase

        public SocketProcessorBase​(SocketWrapperBase<S> socketWrapper,
                                   SocketEvent event)
        Creates a new socket processor for the given wrapper and event.
        Parameters:
        socketWrapper - the socket wrapper
        event - the socket event to process
    • Method Detail

      • reset

        public void reset​(SocketWrapperBase<S> socketWrapper,
                          SocketEvent event)
        Resets this processor with a new socket wrapper and event, allowing reuse.
        Parameters:
        socketWrapper - the socket wrapper
        event - the socket event to process
      • run

        public final void run()
        Specified by:
        run in interface java.lang.Runnable
      • doRun

        protected abstract void doRun()
        Performs the actual socket processing work. Subclasses implement this method to define the specific processing logic for each endpoint type.