public class BusyTimedPauser extends Object implements Pauser, TimingPauser
BusyPauser but also supporting TimingPauserPauser.SleepyWarningBALANCED, MIN_BUSY, MIN_PROCESSORS, SLEEPY| Constructor and Description |
|---|
BusyTimedPauser() |
| Modifier and Type | Method and Description |
|---|---|
long |
countPaused()
Returns the count of how many times the
pause() method has been called. |
boolean |
isBusy()
Always returns
true, indicating that this pauser predominantly keeps the thread busy. |
void |
pause()
Pauses the current thread.
|
void |
pause(long timeout,
TimeUnit timeUnit)
Attempts to pause the thread with a specified timeout.
|
void |
reset()
Resets the pauser's internal state back (if any) to the most aggressive setting.
|
long |
timePaused()
Always returns
0 as this pauser does not actually track total pause time. |
String |
toString()
Provides a string representation for this pauser, identifying it as "PauserMode.timedBusy".
|
void |
unpause()
Does nothing since this implementation has no state to unpause from.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitasyncPause, asyncPausing, balanced, balancedUpToMillis, busy, getBalanced, getSleepy, millis, millis, sleepy, timedBusy, yielding, yieldingpublic boolean isBusy()
true, indicating that this pauser predominantly keeps the thread busy.public void reset()
PauserPausers that progressively increases the pause time are reset back to its lowest pause time.
Call this if you just did some work.
public void pause()
PauserThe actual pause time and thread scheduling impact is not specified and depends on the implementing class. For some implementations, a progressive increase of the pause time is employed, thread executions may or may not be yielded, whereas other implementations may not pause or yield at all.
Thus, depending on the implementation this could do nothing (busy spin), yield, sleep, ...
Call this if no work was done.
public void pause(long timeout,
TimeUnit timeUnit)
throws TimeoutException
TimeoutException is thrown, indicating the timeout has elapsed without resumption of operations.pause in interface Pauserpause in interface TimingPausertimeout - the maximum time to wait before throwing an exceptiontimeUnit - the unit of time for the timeout parameterTimeoutException - if the wait exceeds the specified timeout durationpublic void unpause()
public long timePaused()
0 as this pauser does not actually track total pause time.timePaused in interface Pauser0, indicating no measurable pause durationpublic long countPaused()
pause() method has been called.countPaused in interface PauserCopyright © 2024. All rights reserved.