Interface SelectStrategy


  • 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 int BUSY_WAIT
      Indicates the IO loop to poll for new events without blocking.
      static int CONTINUE
      Indicates the IO loop should be retried, no blocking select to follow directly.
      static int SELECT
      Indicates a blocking select should follow.
    • Field Detail

      • SELECT

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

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

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

      • calculateStrategy

        int calculateStrategy​(IntSupplier selectSupplier,
                              boolean notBlockForIo)
                       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.
        notBlockForIo - true if blocking for IO is not allowed.
        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