|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.plt.concurrent.ConditionMonitor
public class ConditionMonitor
Provides a convenient facility for blocking until an arbitrary condition is satisfied.
Each time check() is invoked, the blocked threads check to see if the condition
has become true. Note that there is no way for this to occur "automatically" —
the only way the monitor can be made aware of a possible change is by an explicit call to check().
| Constructor Summary | |
|---|---|
ConditionMonitor(Condition condition)
Create an unsignaled completion monitor. |
|
| Method Summary | |
|---|---|
boolean |
attemptEnsureTrue()
Tries to ensure that the condition is true before continuing. |
boolean |
attemptEnsureTrue(long timeout)
Tries to ensure that the monitor has been signaled before continuing. |
boolean |
attemptEnsureTrue(long timeout,
java.util.concurrent.TimeUnit unit)
Tries to ensure that the monitor has been signaled before continuing. |
void |
check()
Check the condition and, if it is now true, notify all blocked threads. |
void |
ensureTrue()
Ensures that the condition is true before continuing. |
void |
ensureTrue(long timeout)
Ensures that the condition is true before continuing. |
void |
ensureTrue(long timeout,
java.util.concurrent.TimeUnit unit)
Ensures that the condition is true before continuing. |
boolean |
isTrue()
Returns whether the flag is currently set |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConditionMonitor(Condition condition)
| Method Detail |
|---|
public boolean isTrue()
isTrue in interface Conditionpublic void check()
true, notify all blocked threads.
public void ensureTrue()
throws java.lang.InterruptedException
java.lang.InterruptedException
public void ensureTrue(long timeout)
throws java.lang.InterruptedException,
java.util.concurrent.TimeoutException
timeout - Maximum wait time, in milliseconds.
java.lang.InterruptedException
java.util.concurrent.TimeoutException
public void ensureTrue(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.TimeoutException
timeout - Maximum wait time, in unit units.unit - Units for timeout.
java.lang.InterruptedException
java.util.concurrent.TimeoutExceptionpublic boolean attemptEnsureTrue()
false.
public boolean attemptEnsureTrue(long timeout)
false.
timeout - Maximum wait time, in milliseconds.
public boolean attemptEnsureTrue(long timeout,
java.util.concurrent.TimeUnit unit)
false.
timeout - Maximum wait time, in unit units.unit - Units for timeout.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||