|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dellroad.stuff.java.TimedWait
public final class TimedWait
Utility class for performing timed waits on objects.
Object.wait(long)| Method Summary | |
|---|---|
static boolean |
wait(Object obj,
long timeout,
Predicate predicate)
Wait (using Object.wait()) up to a given time limit for some predicate to become true. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean wait(Object obj,
long timeout,
Predicate predicate)
throws InterruptedException
Object.wait()) up to a given time limit for some predicate to become true.
This method correctly handles spurious wakeups, restarting the wait loop as necessary.
This method assumes that obj will be notified whent the predicate becomes true and that the current thread
is already synchronized on obj.
This method uses System.nanoTime() instead of System.currentTimeMillis() and so is immune to
adjustments in clock time.
obj - object to sleep on; must already be lockedtimeout - wait timeout in milliseconds, or zero for an infinite waitpredicate - predicate to test
IllegalArgumentException - if timeout is negative
IllegalMonitorStateException - if obj is not already locked
InterruptedException - if the current thread is interrupted
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||