public class JSR166TestCase.CheckedBarrier extends CyclicBarrier
Constructor and Description |
---|
CheckedBarrier(int parties) |
Modifier and Type | Method and Description |
---|---|
int |
await()
Waits until all parties have invoked
await on this barrier. |
await, getNumberWaiting, getParties, isBroken, reset
public int await()
CyclicBarrier
await
on this barrier.
If the current thread is not the last to arrive then it is disabled for thread scheduling purposes and lies dormant until one of the following things happens:
CyclicBarrier.reset()
on this barrier.
If the current thread:
InterruptedException
is thrown and the current thread's
interrupted status is cleared.
If the barrier is CyclicBarrier.reset()
while any thread is waiting,
or if the barrier is broken when
await
is invoked, or while any thread is waiting, then
BrokenBarrierException
is thrown.
If any thread is interrupted while waiting,
then all other waiting threads will throw
BrokenBarrierException
and the barrier is placed in the broken
state.
If the current thread is the last thread to arrive, and a non-null barrier action was supplied in the constructor, then the current thread runs the action before allowing the other threads to continue. If an exception occurs during the barrier action then that exception will be propagated in the current thread and the barrier is placed in the broken state.
await
in class CyclicBarrier
getParties() - 1
indicates the first
to arrive and zero indicates the last to arrive