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 -
Method Summary
Modifier and TypeMethodDescriptionintcalculateStrategy(IntSupplier selectSupplier, boolean hasTasks) TheSelectStrategycan be used to steer the outcome of a potential select call.
-
Field Details
-
SELECT
static final int SELECTIndicates a blocking select should follow.- See Also:
-
CONTINUE
static final int CONTINUEIndicates the IO loop should be retried, no blocking select to follow directly.- See Also:
-
BUSY_WAIT
static final int BUSY_WAITIndicates the IO loop to poll for new events without blocking.- See Also:
-
-
Method Details
-
calculateStrategy
TheSelectStrategycan 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:
SELECTif the next step should be blocking selectCONTINUEif 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
-