public class DynamicBarrier extends InternalBarrier
This class follows DbC(tm) methodology
(Wikipedia).
Where possible, contracts are implement with native's Java
assert.
Constructor and Description |
---|
DynamicBarrier()
Constructs a new dynamic barrier registering waiting threads.
|
DynamicBarrier(boolean registerAwaitingThreads)
Constructs a new dynamic barrier.
|
Modifier and Type | Method and Description |
---|---|
void |
await()
Caller will wait until all signed barrier threads are also waiting, situation
in which all of them are awakened.
|
long |
awaitCount()
Caller will wait until all signed barrier threads are also waiting, situation
in which all of them are awakened.
|
boolean |
isSignIn()
Is current thread registered in barrier?
|
int |
numberWaitingThreads()
Number of threads currently waiting on the barrier.
|
void |
signIn()
Add signature of current thread in the barrier.
|
void |
signOut()
Remove signature of current thread in the barrier.
|
int |
size()
Number of threads defined for the barrier.
|
await, await, broadcast, interruptWaitingThreads, lockIsMine, registerAwaitingThreads, signal, syncronizedLockIsMine
public DynamicBarrier()
public DynamicBarrier(boolean registerAwaitingThreads)
registerAwaitingThreads
- if true, threads are registered when waitingpublic boolean isSignIn()
public void signIn()
!isSignIn()
isSignIn()
public void signOut()
isSignIn()
!isSignIn()
public int size()
InternalBarrier
size
in class InternalBarrier
public int numberWaitingThreads()
Barrier
numberWaitingThreads
in class Barrier
public void await() throws ThreadInterruptedException
isSignIn()
await
in interface SyncCV
await
in class Barrier
ThreadInterruptedException
public long awaitCount() throws ThreadInterruptedException
isSignIn()
awaitCount
in class Barrier
count
ThreadInterruptedException