|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.plt.concurrent.CompletionMonitor
public class CompletionMonitor
Provides a convenient facility for blocking until a boolean flag is signaled. Typically, this is used for communication in which one thread must complete a task before other threads can proceed.
| Constructor Summary | |
|---|---|
CompletionMonitor()
Create an unsignaled completion monitor. |
|
CompletionMonitor(boolean signaled)
Create a completion monitor in the given initial state. |
|
| Method Summary | |
|---|---|
boolean |
attemptEnsureSignaled()
Tries to ensure that the monitor has been signaled before continuing. |
boolean |
attemptEnsureSignaled(long timeout)
Tries to ensure that the monitor has been signaled before continuing. |
boolean |
attemptEnsureSignaled(long timeout,
TimeUnit unit)
Tries to ensure that the monitor has been signaled before continuing. |
void |
ensureSignaled()
Ensures that the monitor has been signaled before continuing. |
void |
ensureSignaled(long timeout)
Ensures that the monitor has been signaled before continuing. |
void |
ensureSignaled(long timeout,
TimeUnit unit)
Ensures that the monitor has been signaled before continuing. |
boolean |
isSignaled()
Returns whether the flag is currently set |
boolean |
isTrue()
Returns whether the flag is currently set |
void |
reset()
Revert to the unsignaled state |
void |
signal()
Sets the state to signaled and alerts all blocked threads |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CompletionMonitor()
public CompletionMonitor(boolean signaled)
true, invocations of
ensureSignaled() will not block until reset() is invoked.
| Method Detail |
|---|
public boolean isSignaled()
public boolean isTrue()
isTrue in interface Conditionpublic void reset()
public void signal()
public void ensureSignaled()
throws InterruptedException
InterruptedException
public void ensureSignaled(long timeout)
throws InterruptedException,
TimeoutException
timeout - Maximum wait time, in milliseconds.
InterruptedException
TimeoutException
public void ensureSignaled(long timeout,
TimeUnit unit)
throws InterruptedException,
TimeoutException
timeout - Maximum wait time, in unit units.unit - Units for timeout.
InterruptedException
TimeoutExceptionpublic boolean attemptEnsureSignaled()
false.
public boolean attemptEnsureSignaled(long timeout)
false.
timeout - Maximum wait time, in milliseconds.
public boolean attemptEnsureSignaled(long timeout,
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 | |||||||||