Class AbstractIOStrategy

java.lang.Object
org.glassfish.grizzly.strategies.AbstractIOStrategy
All Implemented Interfaces:
IOStrategy, WorkerThreadPoolConfigProducer
Direct Known Subclasses:
LeaderFollowerNIOStrategy, SameThreadIOStrategy, WorkerThreadIOStrategy

public abstract class AbstractIOStrategy extends Object implements IOStrategy
Author:
oleksiys
  • Field Details

    • ENABLE_INTEREST_LIFECYCLE_LISTENER

      protected static final IOEventLifeCycleListener ENABLE_INTEREST_LIFECYCLE_LISTENER
  • Constructor Details

    • AbstractIOStrategy

      public AbstractIOStrategy()
  • Method Details

    • createDefaultWorkerPoolConfig

      public ThreadPoolConfig createDefaultWorkerPoolConfig(Transport transport)
      Specified by:
      createDefaultWorkerPoolConfig in interface WorkerThreadPoolConfigProducer
    • executeIoEvent

      public final boolean executeIoEvent(Connection connection, IOEvent ioEvent) throws IOException
      Description copied from interface: IOStrategy
      The SelectorRunner will invoke this method to allow the strategy implementation to decide how the IOEvent will be handled.
      Specified by:
      executeIoEvent in interface IOStrategy
      Parameters:
      connection - the Connection upon which the provided IOEvent occurred.
      ioEvent - the IOEvent that triggered execution of this strategy
      Returns:
      true, if this thread should keep processing IOEvents on the current and other Connections, or false if this thread should hand-off the farther IOEvent processing on any Connections, which means IOStrategy is becoming responsible for continuing IOEvent processing (possibly starting new thread, which will handle IOEvents).
      Throws:
      IOException - if an error occurs processing the IOEvent.
    • getThreadPoolFor

      public Executor getThreadPoolFor(Connection connection, IOEvent ioEvent)
      Description copied from interface: IOStrategy
      Returns an Executor to be used to run given ioEvent processing for the given connection. A null value will be returned if the ioEvent should be executed in the kernel thread.
      Specified by:
      getThreadPoolFor in interface IOStrategy
      Parameters:
      connection - Connection
      ioEvent - the event to get the Executor for
      Returns:
      an Executor to be used to run given ioEvent processing for the given connection
    • isReadWrite

      protected static boolean isReadWrite(IOEvent ioEvent)
    • fireIOEvent

      protected static void fireIOEvent(Connection connection, IOEvent ioEvent, IOEventLifeCycleListener listener, Logger logger)