com.distributed.api
Class ConsensusFinder

java.lang.Object
  |
  +--com.distributed.api.ConsensusFinder
All Implemented Interfaces:
TimerTask

public class ConsensusFinder
extends java.lang.Object
implements TimerTask

Class implementing Consensus finding Algorithm


Field Summary
static int APPEND
          Constant used in the Class
 boolean consensuson
          Variable used by the Users of Class
static int GETANDSET
          Constant used in the Class
static int SET
          Constant used in the Class
 
Constructor Summary
ConsensusFinder(int Nprocs, int fail, Environment parent)
          Constructor to be normally used
 
Method Summary
 void othersProposition(int val)
          Method to take action when Proposal is received from others
 void runTask()
          Method to Run the entire Consensus task
 void startConsensusRounds(int val, boolean starturself)
          Method to start Consensus Process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APPEND

public static final int APPEND
Constant used in the Class

See Also:
Constant Field Values

consensuson

public boolean consensuson
Variable used by the Users of Class


GETANDSET

public static final int GETANDSET
Constant used in the Class

See Also:
Constant Field Values

SET

public static final int SET
Constant used in the Class

See Also:
Constant Field Values
Constructor Detail

ConsensusFinder

public ConsensusFinder(int Nprocs,
                       int fail,
                       Environment parent)
Constructor to be normally used

Parameters:
Nprocs - No. of processes in the system
fail - Whether processes fails or not
parent - Reference to Environment of this process
Method Detail

othersProposition

public void othersProposition(int val)
Method to take action when Proposal is received from others

Parameters:
val - Value Received

runTask

public void runTask()
Method to Run the entire Consensus task

Specified by:
runTask in interface TimerTask

startConsensusRounds

public void startConsensusRounds(int val,
                                 boolean starturself)
Method to start Consensus Process

Parameters:
val - Value proposed from this process
starturself - indicates whether consensus is to be started by this process or not