public enum PauserMode extends Enum<PauserMode> implements Supplier<Pauser>
Pauser objects.
This enum facilitates the creation of different pausing strategies that control thread execution based on CPU availability and desired pausing characteristics.
Because Pauser is not an enum, and implementations are not Marshallable, using this enum helps in making configurations more YAML-friendly.
For detailed descriptions of the different Pauser modes and their specific properties, see: Pauser Mode features
| Enum Constant and Description |
|---|
balanced
Provides a
Pauser that busy-waits (spins at 100% CPU) for short durations
and then backs off when idle for longer periods. |
busy
Returns a Supplier providing pausers this will busy wait (spin-wait at 100% CPU)
if there are sufficient available processors.
|
milli
Provides a
Pauser that sleeps for one millisecond consistently, without any backing off. |
sleepy
|
timedBusy
|
yielding
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isolcpus()
Indicates whether the provided
Pauser is suitable for CPU isolation. |
boolean |
monitor()
Indicates whether the provided
Pauser can be monitored. |
static PauserMode |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static PauserMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final PauserMode balanced
Pauser that busy-waits (spins at 100% CPU) for short durations
and then backs off when idle for longer periods.
If there are not sufficient available processors, returns sleepy depending on the system property "pauser.minProcessors".
This strategy is ideal for balancing responsiveness with CPU consumption.
Pauser.balanced(),
Runtime.availableProcessors()public static final PauserMode busy
balanced or even sleepy depending on the system property "pauser.minProcessors".
This pauser is designed for scenarios requiring high responsiveness at the cost of higher CPU usage.
Pauser.busy(),
Runtime.availableProcessors()public static final PauserMode milli
Pauser that sleeps for one millisecond consistently, without any backing off.
Milli pausers have long latency times but require minimum CPU resources.
Pauser.millis(int)public static final PauserMode sleepy
Pauser that is less aggressive than balanced, using sleep intervals to conserve CPU resources.
Suitable for lower-priority tasks where response time is less critical.
Pauser.sleepy()public static final PauserMode timedBusy
busy but provides a Pauser supporting timed waits.
This pauser combines busy-waiting with timed pauses to optimize CPU usage during variable workload conditions.
Pauser.timedBusy()public static final PauserMode yielding
Pauser that yields thread execution if there are sufficient processors, otherwise it falls back to balanced or sleepy depending on the system property "pauser.minProcessors".
It is designed to maintain responsiveness without consuming excessive CPU resources in systems with sufficient processing power.
Pauser.yielding()public static PauserMode[] values()
for (PauserMode c : PauserMode.values()) System.out.println(c);
public static PauserMode valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic boolean isolcpus()
Pauser is suitable for CPU isolation.true if CPU isolation is suitable, otherwise falsepublic boolean monitor()
Pauser can be monitored.true if the pauser can be monitored, otherwise falseCopyright © 2024. All rights reserved.