|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.tomgibara.pronto.util.Waiter
public class Waiter
An instance of this object can wait on an object's monitor until a condition is met, or a given number of milliseconds has elapsed - which ever occurs soonest. The class expects that it will be notified via the specified monitor when the condition may have changed. This class is safe for multithreaded use.
| Nested Class Summary | |
|---|---|
static interface |
Waiter.Condition
Implementations of this interface are supplied to a Waiter and control when the object may cease waiting. |
| Constructor Summary | |
|---|---|
Waiter(java.lang.Object monitor)
Creates a new waiter for waiting on the supplied object. |
|
| Method Summary | |
|---|---|
java.lang.Object |
getMonitor()
The monitor on which this object will wait for changes in condition. |
protected boolean |
handleInterruption(java.lang.InterruptedException e)
This method is called when an interruption occurs while waiting. |
boolean |
waitForCondition(long timeout,
Waiter.Condition cond)
This method will cause the calling thread to wait until the specified condtion is met or a timeout occurs, which ever is soonest. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Waiter(java.lang.Object monitor)
monitor - the object on which the waiter waits for a change in
condition.| Method Detail |
|---|
public java.lang.Object getMonitor()
public boolean waitForCondition(long timeout,
Waiter.Condition cond)
timeout - the number of milliseconds to wait for, or 0 to wait
indefinitelycond - the condition for a timely return from this method
protected boolean handleInterruption(java.lang.InterruptedException e)
e - the interrupting exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||