|
jbarrier | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.bonn.cs.net.jbarrier.barrier.AbstractBarrier
public abstract class AbstractBarrier
Abstract base class for all barrier implementations of this package. Barriers
extending this class can have an associated (global) action, specified as a
Runnable
, which will be executed by one party when all parties have
reached the barrier. Also, arbitrary global reductions are supported with the
help of a GenericReductor
object.
With respect to memory consistency, just like with the
CyclicBarrier
, actions in a thread prior to
calling await(int)
happen-before actions that are part of the
barrier action, which in turn happen-before actions following a successful
return from await(int)
in other threads.
At this point, there is not much of an error handling if, e.g., threads get
interrupted during the barrier. A well-defined error handling, such as the
BrokenBarrierException
used by the
CyclicBarrier
, may be added in future versions.
Field Summary | |
---|---|
protected java.lang.Runnable |
action_
The command to execute when the barrier is tripped, or null
if there is no action. |
protected GenericReductor |
genericReductor_
An optional generic reduction operator. |
protected int |
numParties_
The number of parties taking part in the barrier. |
Constructor Summary | |
---|---|
protected |
AbstractBarrier(int numParties,
java.lang.Runnable action,
GenericReductor genericReductor)
Creates a new AbstractBarrier that will trip when the given
number of parties are waiting upon it. |
Method Summary | |
---|---|
abstract void |
await(int threadId)
Called by a party that reaches the barrier. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final int numParties_
protected final java.lang.Runnable action_
null
if there is no action.
protected final GenericReductor genericReductor_
Constructor Detail |
---|
protected AbstractBarrier(int numParties, java.lang.Runnable action, GenericReductor genericReductor)
AbstractBarrier
that will trip when the given
number of parties are waiting upon it.
numParties
- the number of parties that must reach the barrier before the
barrier is trippedaction
- the command to execute when the barrier is tripped, or
null
if there is no actiongenericReductor
- an optional generic reductor
java.lang.IllegalArgumentException
- if numParties
is less than 2Method Detail |
---|
public abstract void await(int threadId)
await
in interface Barrier
threadId
- the ID of the party
|
jbarrier | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |