Package io.netty.channel
Interface SelectStrategy
-
public interface SelectStrategySelect 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 intBUSY_WAITIndicates the IO loop to poll for new events without blocking.static intCONTINUEIndicates the IO loop should be retried, no blocking select to follow directly.static intSELECTIndicates a blocking select should follow.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intcalculateStrategy(IntSupplier selectSupplier, boolean hasTasks)TheSelectStrategycan be used to steer the outcome of a potential select call.
-
-
-
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 hasTasks) throws java.lang.Exception
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:
java.lang.Exception
-
-