|
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
edu.bonn.cs.net.jbarrier.barrier.CentralBarrier
public class CentralBarrier
Implementation of a central barrier algorithm based on a shared counter. Of
all algorithms in this package, this one is most similar to the
CyclicBarrier
.
Field Summary | |
---|---|
protected java.util.concurrent.atomic.AtomicInteger |
counter_
The central counter variable. |
protected boolean |
go_
Global out flag. |
Fields inherited from class edu.bonn.cs.net.jbarrier.barrier.AbstractBarrier |
---|
action_, genericReductor_, numParties_ |
Constructor Summary | |
---|---|
CentralBarrier(int numParties)
Constructor (if no action is used). |
|
CentralBarrier(int numParties,
java.lang.Runnable barrierAction)
Constructor. |
|
CentralBarrier(int numParties,
java.lang.Runnable barrierAction,
GenericReductor genericReductor)
Constructor. |
Method Summary | |
---|---|
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 java.util.concurrent.atomic.AtomicInteger counter_
protected volatile boolean go_
Constructor Detail |
---|
public CentralBarrier(int numParties, java.lang.Runnable barrierAction, GenericReductor genericReductor)
numParties
- the number of parties that must reach the barrier before the
barrier is trippedbarrierAction
- the command to execute when the barrier is tripped, or
null
if there is no actiongenericReductor
- an optional generic reductorpublic CentralBarrier(int numParties, java.lang.Runnable barrierAction)
numParties
- the number of parties that must reach the barrier before the
barrier is trippedbarrierAction
- the command to execute when the barrier is tripped, or
null
if there is no actionpublic CentralBarrier(int numParties)
numParties
- the number of parties that must reach the barrier before the
barrier is trippedMethod Detail |
---|
public void await(int threadId)
await
in interface Barrier
await
in class AbstractBarrier
threadId
- the ID of the party
|
jbarrier | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |