public enum BusyPauser extends Enum<BusyPauser> implements Pauser
Pauser that employs a busy-wait strategy to keep the CPU actively engaged.
This pauser continuously executes a very short pause (nano-pause) to keep the thread active.
Because it never actually suspends the thread, most operations related to state management (like pausing, unpausing, and timeout handling) are unsupported or no-op.
Pauser.SleepyWarning| Enum Constant and Description |
|---|
INSTANCE |
BALANCED, MIN_BUSY, MIN_PROCESSORS, SLEEPY| Modifier and Type | Method and Description |
|---|---|
long |
countPaused()
Always returns
0 as BusyPauser does not count pauses. |
boolean |
isBusy()
Always returns
true, indicating that this pauser keeps the thread busy rather than truly pausing it. |
void |
pause()
Keeps the thread actively busy by executing a very short pause at the CPU level.
|
void |
pause(long timeout,
TimeUnit timeUnit)
Throws
UnsupportedOperationException as BusyPauser does not support pausing with a timeout. |
void |
reset()
Does nothing as
BusyPauser does not maintain state that requires resetting. |
long |
timePaused()
Always returns
0 as BusyPauser does not track paused time. |
String |
toString()
Provides a string representation of this pauser, identifying it as "PauserMode.busy".
|
void |
unpause()
Does nothing as
BusyPauser has no pausing state to unpause from. |
static BusyPauser |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static BusyPauser[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOfasyncPause, asyncPausing, balanced, balancedUpToMillis, busy, getBalanced, getSleepy, millis, millis, sleepy, timedBusy, yielding, yieldingpublic static final BusyPauser INSTANCE
public static BusyPauser[] values()
for (BusyPauser c : BusyPauser.values()) System.out.println(c);
public static BusyPauser 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 void reset()
BusyPauser does not maintain state that requires resetting.public void pause()
public void pause(long timeout,
TimeUnit timeUnit)
throws TimeoutException
UnsupportedOperationException as BusyPauser does not support pausing with a timeout.pause in interface Pausertimeout - the timeout durationtimeUnit - the unit of time for the timeout durationTimeoutException - never thrownpublic void unpause()
BusyPauser has no pausing state to unpause from.public long timePaused()
0 as BusyPauser does not track paused time.timePaused in interface Pauser0 alwayspublic long countPaused()
0 as BusyPauser does not count pauses.countPaused in interface Pauser0 alwayspublic boolean isBusy()
true, indicating that this pauser keeps the thread busy rather than truly pausing it.public String toString()
toString in class Enum<BusyPauser>Copyright © 2024. All rights reserved.