jbarrier

edu.bonn.cs.net.jbarrier.barrier
Class DisseminationBarrier.DisseminationBarrierParty

java.lang.Object
  extended by edu.bonn.cs.net.jbarrier.barrier.DisseminationBarrier.DisseminationBarrierParty
Enclosing class:
DisseminationBarrier

protected class DisseminationBarrier.DisseminationBarrierParty
extends java.lang.Object

Stores data required by each party that uses the barrier.

Author:
Patrick Peschlow, Ivan Castilla Rodriguez

Field Summary
protected  java.util.concurrent.atomic.AtomicBoolean[][] flagsIn_
          Array of incoming flags for this thread for each round.
protected  int id_
          Unique id of this party [0 .. numParties-1].
protected  boolean outSense_
          Sense flag for the global out flag (only used if there is a barrier action).
protected  int parity_
          Parity bit for alternating barrier episodes.
protected  DisseminationBarrier.DisseminationBarrierParty[] partnersOut_
          Pre-computed array of references to my outgoing partners (whose flag I set) in every round.
protected  boolean sense_
          Sense flag that switches between true and false.
 
Constructor Summary
protected DisseminationBarrier.DisseminationBarrierParty(int threadId)
          Constructor.
 
Method Summary
protected  void await()
          Called when this party reaches the barrier.
protected  void setupBarrier()
          Sets up this party for the barrier algorithm.
protected  void setUpPartyData()
          Sets up the partners array, intended to be overridden in subclasses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id_

protected final int id_
Unique id of this party [0 .. numParties-1].


parity_

protected int parity_
Parity bit for alternating barrier episodes.


sense_

protected boolean sense_
Sense flag that switches between true and false.


outSense_

protected boolean outSense_
Sense flag for the global out flag (only used if there is a barrier action).


flagsIn_

protected final java.util.concurrent.atomic.AtomicBoolean[][] flagsIn_
Array of incoming flags for this thread for each round. First key: parity (0 or 1). Second key: round number. (Note that a volatile boolean[][] is not enough here, because in that case updates would only be triggered when the array reference itself is changed but not when single array elements are modified.)


partnersOut_

protected DisseminationBarrier.DisseminationBarrierParty[] partnersOut_
Pre-computed array of references to my outgoing partners (whose flag I set) in every round.

Constructor Detail

DisseminationBarrier.DisseminationBarrierParty

protected DisseminationBarrier.DisseminationBarrierParty(int threadId)
Constructor.

Parameters:
threadId - the numeric id of this party within the barrier.
Method Detail

setUpPartyData

protected void setUpPartyData()
Sets up the partners array, intended to be overridden in subclasses.


setupBarrier

protected void setupBarrier()
Sets up this party for the barrier algorithm.


await

protected void await()
Called when this party reaches the barrier.


jbarrier

Copyright 2010 Patrick Peschlow