pt.ua.concurrent
Interface Barrier

All Known Implementing Classes:
DynamicBarrier, FixedBarrier

public interface Barrier

A thread barrier interface.

Invariant:
size() > 0
numberWaitingThreads() >= 0 && numberWaitingThreads() < size()

This class follows DbC(tm) methodology (Wikipedia). Where possible, contracts are implement with native's Java assert.

Version:
0.5, October 2013
Author:
Miguel Oliveira e Silva (mos@ua.pt)

Method Summary
 void await()
          Caller will wait until all barrier threads are also waiting, situation in which all of them are awakened.
 int numberWaitingThreads()
          Number of threads currently waiting on the barrier.
 int size()
          Number of threads defined for the barrier.
 

Method Detail

size

int size()
Number of threads defined for the barrier.

Returns:
barrier size

numberWaitingThreads

int numberWaitingThreads()
Number of threads currently waiting on the barrier.

Returns:
number of threads

await

void await()
           throws ThreadInterruptedException
Caller will wait until all barrier threads are also waiting, situation in which all of them are awakened.

Throws:
ThreadInterruptedException