it.unitn.ds.peersim.protocols
Class ConsensusStrongFD

java.lang.Object
  extended by peersim.vector.SingleValueHolder
      extended by it.unitn.ds.peersim.protocols.ConsensusStrongFD
All Implemented Interfaces:
Consensus, java.lang.Cloneable, peersim.cdsim.CDProtocol, peersim.core.Protocol, peersim.edsim.EDProtocol, peersim.vector.SingleValue

public class ConsensusStrongFD
extends peersim.vector.SingleValueHolder
implements java.lang.Cloneable, peersim.edsim.EDProtocol, peersim.cdsim.CDProtocol, Consensus

Distributed Systems Course Project

Year: 2009/2010

University of Trento

Consensus - A simple class for solving consensus problem with the introduction of failure detectors to detect failed nodes.

This class implements Cloneable,

This class implements EDProtocol interface, one of the main core classes of PeerSim simulator, a simulation engine for P2P networks. This is the interface to be implemented by protocols run under the event-driven model. A single method is provided, to deliver events to the protocol.

This class implements CDProtocol interface, one of the main core classes of PeerSim simulator, a simulation engine for P2P networks.

This class implements Consensus interface,

This class extends SingleValueHolder,

Version:
1.0
Author:
Avancini Mattia, Giampaolo Farina
See Also:
http://peersim.sourceforge.net/

Constructor Summary
ConsensusStrongFD(java.lang.String prefix)
          Instantiates a new consensus strong fd.
 
Method Summary
 ConsensusStrongFD clone()
          Method called by the peersim engines to instantiate the protocol on each node of the network.
 boolean getDecided()
          Gets the decided.
 FDParameters getFDParameters()
          Gets the fD parameters.
 java.util.ArrayList<java.lang.Long> getSuspected()
          Gets the fD hints.
 int getTransportID()
          Gets the transport id.
 void nextCycle(peersim.core.Node node, int protocolID)
           
 void processDecideMessage(peersim.core.Node node, int protocolID, Message message)
          Process decide message.
 void processEvent(peersim.core.Node node, int protocolID, java.lang.Object event)
          Handler for messages sender to this node from a remote agent.
 void processPhase1Message(peersim.core.Node node, int protocolID, Message message)
          Process phase1 message.
 void processPhase2Message(peersim.core.Node node, int protocolID, Message message)
          Process phase2 message.
 
Methods inherited from class peersim.vector.SingleValueHolder
getValue, setValue, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unitn.ds.peersim.protocols.interfaces.Consensus
getValue
 

Constructor Detail

ConsensusStrongFD

public ConsensusStrongFD(java.lang.String prefix)
Instantiates a new consensus strong fd.

Parameters:
prefix - the prefix
Method Detail

clone

public ConsensusStrongFD clone()
Method called by the peersim engines to instantiate the protocol on each node of the network. It defines the protocol's variables which are local on each node.

Specified by:
clone in interface peersim.core.Protocol
Overrides:
clone in class peersim.vector.SingleValueHolder
Returns:
the consensus strong fd

nextCycle

public void nextCycle(peersim.core.Node node,
                      int protocolID)
Specified by:
nextCycle in interface peersim.cdsim.CDProtocol

processEvent

public void processEvent(peersim.core.Node node,
                         int protocolID,
                         java.lang.Object event)
Handler for messages sender to this node from a remote agent. Since our protocol is made of a numbered of messages issued by agents which plays different roles, we map each agent to a specific event. This method acts as a dispatcher.

Specified by:
processEvent in interface peersim.edsim.EDProtocol
Parameters:
node - the node
protocolID - the protocol id
event - the event

processPhase1Message

public void processPhase1Message(peersim.core.Node node,
                                 int protocolID,
                                 Message message)
Process phase1 message.

Parameters:
node - the node
protocolID - the protocol id
message - the message

processPhase2Message

public void processPhase2Message(peersim.core.Node node,
                                 int protocolID,
                                 Message message)
Process phase2 message.

Parameters:
node - the node
protocolID - the protocol id
message - the message

processDecideMessage

public void processDecideMessage(peersim.core.Node node,
                                 int protocolID,
                                 Message message)
Process decide message.

Parameters:
node - the node
protocolID - the protocol id
message - the message

getTransportID

public int getTransportID()
Gets the transport id.

Specified by:
getTransportID in interface Consensus
Returns:
the transportID

getFDParameters

public FDParameters getFDParameters()
Description copied from interface: Consensus
Gets the fD parameters.

Specified by:
getFDParameters in interface Consensus
Returns:
the fD parameters
See Also:
Consensus.getFDParameters()

getDecided

public boolean getDecided()
Description copied from interface: Consensus
Gets the decided.

Specified by:
getDecided in interface Consensus
Returns:
the decided
See Also:
Consensus.getDecided()

getSuspected

public java.util.ArrayList<java.lang.Long> getSuspected()
Description copied from interface: Consensus
Gets the fD hints.

Specified by:
getSuspected in interface Consensus
Returns:
the fD hints
See Also:
FailureDetector.callOracle()