Interface SelectStrategy

All Known Implementing Classes:
DefaultSelectStrategy

public interface SelectStrategy
Select strategy interface. Provides the ability to control the behavior of the select loop. For example a blocking select operation can be delayed or skipped entirely if there are events to process immediately.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Indicates the IO loop to poll for new events without blocking.
    static final int
    Indicates the IO loop should be retried, no blocking select to follow directly.
    static final int
    Indicates a blocking select should follow.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    calculateStrategy(IntSupplier selectSupplier, boolean hasTasks)
    The SelectStrategy can be used to steer the outcome of a potential select call.
  • Field Details

    • SELECT

      static final int SELECT
      Indicates a blocking select should follow.
      See Also:
    • CONTINUE

      static final int CONTINUE
      Indicates the IO loop should be retried, no blocking select to follow directly.
      See Also:
    • BUSY_WAIT

      static final int BUSY_WAIT
      Indicates the IO loop to poll for new events without blocking.
      See Also:
  • Method Details

    • calculateStrategy

      int calculateStrategy(IntSupplier selectSupplier, boolean hasTasks) throws Exception
      The SelectStrategy can be used to steer the outcome of a potential select call.
      Parameters:
      selectSupplier - The supplier with the result of a select result.
      hasTasks - true if tasks are waiting to be processed.
      Returns:
      SELECT if the next step should be blocking select CONTINUE if the next step should be to not select but rather jump back to the IO loop and try again. Any value >= 0 is treated as an indicator that work needs to be done.
      Throws:
      Exception