public interface Pauser
| Modifier and Type | Interface and Description |
|---|---|
static class |
Pauser.SleepyWarning |
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_PROCESSORS |
static boolean |
SLEEPY |
| Modifier and Type | Method and Description |
|---|---|
static Pauser |
balanced()
A balanced pauser which tries to be busy for short bursts but backs off when idle.
|
static Pauser |
balancedUpToMillis(int millis)
A balanced pauser which tries to be busy for short bursts but backs off when idle.
|
static Pauser |
busy()
A busy pauser which never waits
|
long |
countPaused()
Returns the number of times the pauser has checked for
completion.
|
static boolean |
getSleepy() |
static MilliPauser |
millis(int millis)
Wait a fixed time before running again unless woken
|
static Pauser |
millis(int minMillis,
int maxMillis)
A balanced pauser which tries to be busy for short bursts but backs off when idle.
|
void |
pause()
Pauses the current thread.
|
default void |
pause(long timeout,
TimeUnit timeUnit)
use
TimingPauser.pause(long, TimeUnit) instead |
void |
reset()
Resets the pauser's internal state back to the most aggressive setting.
|
static TimingPauser |
sleepy() |
static TimingPauser |
timedBusy() |
long |
timePaused()
Returns the paused time so far in milliseconds.
|
void |
unpause()
Try to cancel the pausing if it is pausing.
|
static Pauser |
yielding()
Yielding pauser.
|
static Pauser |
yielding(int minBusy) |
void reset()
Call this if you just did some work.
void pause()
Depending on the implementation this could do nothing (busy spin), yield, sleep, ...
Call this if no work was done.
default void pause(long timeout,
TimeUnit timeUnit)
throws TimeoutException
TimingPauser.pause(long, TimeUnit) insteadTimeoutExceptionvoid unpause()
No guarantee is made as to if unpause will actually have an effect.
long timePaused()
long countPaused()
static boolean getSleepy()
static Pauser yielding(int minBusy)
static TimingPauser sleepy()
static Pauser balanced()
static Pauser balancedUpToMillis(int millis)
millis - maximum millis (unless in debug mode)static MilliPauser millis(int millis)
millis - to wait forstatic Pauser millis(int minMillis, int maxMillis)
minMillis - starting millismaxMillis - maximum millisstatic Pauser yielding()
@NotNull static Pauser busy()
@NotNull static TimingPauser timedBusy()
Copyright © 2020. All rights reserved.