public class FixedBarrier extends InternalBarrier
This class follows DbC(tm) methodology
(Wikipedia).
Where possible, contracts are implement with native's Java assert.
| Constructor and Description |
|---|
FixedBarrier(int size)
Constructs a new fixed size barrier for
size threads registering waiting threads. |
FixedBarrier(int size,
boolean registerAwaitingThreads)
Constructs a new fixed size barrier for
size threads. |
| Modifier and Type | Method and Description |
|---|---|
void |
await()
Caller will wait until the thread barrier is released, situation
in which all waiting threads are awakened.
|
long |
awaitCount()
Caller will wait until the thread barrier is released, situation
in which all waiting threads are awakened.
|
int |
numberWaitingThreads()
Number of threads currently waiting on the barrier.
|
void |
setSize(int size)
Define a new size for the barrier.
|
int |
size()
Number of threads defined for the barrier.
|
await, await, broadcast, interruptWaitingThreads, lockIsMine, registerAwaitingThreads, signal, syncronizedLockIsMinepublic FixedBarrier(int size)
size threads registering waiting threads.
size > 0size - barrier's number of threadspublic FixedBarrier(int size,
boolean registerAwaitingThreads)
size threads.
size > 0size - barrier's number of threadsregisterAwaitingThreads - if true, threads are registered when waitingpublic void setSize(int size)
size > 0size - barrier's number of threadspublic int size()
InternalBarriersize in class InternalBarrierpublic int numberWaitingThreads()
BarriernumberWaitingThreads in class Barrierpublic void await()
throws ThreadInterruptedException
Barriercount() == old(count())+ 1await in interface SyncCVawait in class BarrierThreadInterruptedExceptionpublic long awaitCount()
throws ThreadInterruptedException
Barriercount() == old(count())+ 1awaitCount in class BarriercountThreadInterruptedException