|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.unboundid.util.WakeableSleeper
@ThreadSafety(level=MOSTLY_NOT_THREADSAFE) public final class WakeableSleeper
This class provides a utility that can be used to sleep for a specified
period of time in a manner that allows it to be woken up if necessary. A
single instance of this class may only be used to allow one thread to sleep
at any given time, so if multiple threads need to sleep at the same time then
a separate WakeableSleeper instance should be used for each.
| Constructor Summary | |
|---|---|
WakeableSleeper()
Creates a new instance of this wakeable sleeper. |
|
| Method Summary | |
|---|---|
boolean |
sleep(long time)
Attempts to sleep for the specified length of time in milliseconds, subject to the accuracy available within the JVM and underlying system. |
void |
wakeup()
Indicates that the sleeper should wake up if it is currently sleeping. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WakeableSleeper()
| Method Detail |
|---|
@ThreadSafety(level=NOT_THREADSAFE) public boolean sleep(long time)
WakeableSleeper instance
by multiple threads at the same time.
time - The length of time in milliseconds to sleep.
true if the sleep completed, or false if it was
woken or interrupted prematurely.@ThreadSafety(level=COMPLETELY_THREADSAFE) public void wakeup()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||