jbarrier

edu.bonn.cs.net.jbarrier.barrier
Class LongCentralReduction

java.lang.Object
  extended by edu.bonn.cs.net.jbarrier.barrier.AbstractBarrier
      extended by edu.bonn.cs.net.jbarrier.barrier.CentralBarrier
          extended by edu.bonn.cs.net.jbarrier.barrier.LongCentralReduction
All Implemented Interfaces:
Barrier, LongReduction

public class LongCentralReduction
extends CentralBarrier
implements LongReduction

Implementation of a central barrier algorithm including a long reduction.

Version:
1.0
Author:
Patrick Peschlow, Ivan Castilla Rodriguez

Field Summary
 
Fields inherited from class edu.bonn.cs.net.jbarrier.barrier.CentralBarrier
counter_, go_
 
Fields inherited from class edu.bonn.cs.net.jbarrier.barrier.AbstractBarrier
action_, genericReductor_, numParties_
 
Constructor Summary
LongCentralReduction(int numParties, ReductionOperator reductor)
          Constructor.
LongCentralReduction(int numParties, java.lang.Runnable barrierAction, ReductionOperator reductor)
          Constructor.
 
Method Summary
 long await(int threadId, long value)
          Called by a party that reaches the barrier.
 
Methods inherited from class edu.bonn.cs.net.jbarrier.barrier.CentralBarrier
await
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LongCentralReduction

public LongCentralReduction(int numParties,
                            java.lang.Runnable barrierAction,
                            ReductionOperator reductor)
Constructor.

Parameters:
numParties - the number of parties that must reach the barrier before the barrier is tripped
barrierAction - the command to execute when the barrier is tripped, or null if there is no action
reductor - the reduction operator to use

LongCentralReduction

public LongCentralReduction(int numParties,
                            ReductionOperator reductor)
Constructor.

Parameters:
numParties - the number of parties that must reach the barrier before the barrier is tripped
reductor - the reduction operator to use
Method Detail

await

public long await(int threadId,
                  long value)
Called by a party that reaches the barrier.

Specified by:
await in interface LongReduction
Parameters:
threadId - the ID of the party
value - the value subject to the reduction
Returns:
the result of the reduction

jbarrier

Copyright 2010 Patrick Peschlow