|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectapp.util.OneShotTimeoutBarrier
public final class OneShotTimeoutBarrier
A OneShotTimeoutBarrier
, like a Token
, is a form
of binary semaphore, but with two differences: (a) the
passWhenOpen(long)
/P() operation has a timeout, and (b) it is
"one-shot" in that the passWhenOpen(long)
method should be
called by a single thread on a single occasion only.
Method Summary | |
---|---|
static OneShotTimeoutBarrier |
newBarrier()
Creates and returns a new one-shot barrier. |
void |
open()
Opens this barrier provided it has not already timed out; if a thread is currently blocked on passWhenOpen(long) , that thread will
be unblocked as a result. |
boolean |
passWhenOpen(long timeout)
Acquires the permission to proceed represented by this barrier, blocking if necessary until it is opened by another thread or until the specified timeout has elapsed (more or less), and returns true if and only if the barrier is open. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final OneShotTimeoutBarrier newBarrier()
public final boolean passWhenOpen(long timeout) throws java.lang.InterruptedException
true
if and only if the barrier is open.
java.lang.InterruptedException
public final void open()
passWhenOpen(long)
, that thread will
be unblocked as a result.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |