infoservice.agreement.paxos
Class PaxosAcceptor

java.lang.Object
  extended by infoservice.agreement.paxos.PaxosObject
      extended by infoservice.agreement.paxos.PaxosCommunicator
          extended by infoservice.agreement.paxos.PaxosProposer
              extended by infoservice.agreement.paxos.PaxosAcceptor
All Implemented Interfaces:
TimeoutListener
Direct Known Subclasses:
PaxosAdapter

public abstract class PaxosAcceptor
extends PaxosProposer
implements TimeoutListener


Field Summary
protected  java.util.Hashtable m_paxosInstances
          A collection of all running PAXOS instances
 
Fields inherited from class infoservice.agreement.paxos.PaxosProposer
m_lastRandom
 
Fields inherited from class infoservice.agreement.paxos.PaxosCommunicator
m_targets
 
Constructor Summary
PaxosAcceptor()
           
 
Method Summary
private  void addCollectMessage(PaxosMessage a_msg)
          Adds a CollectMessage.
private  void addDecideMessage(PaxosMessage a_msg)
          Adds a DecideMessage.
private  void addFreezeMessage(PaxosMessage a_msg)
          Adds a FreezeMessage.
private  void addFreezeProofMessage(PaxosMessage a_msg)
          Adds a FreezeProofMessage.
 void addMessage(PaxosMessage a_msg)
          This gets called if a PaxosMessage arrives.
private  void addProposeMessage(PaxosMessage a_msg)
          Adds a ProposeMessage.
private  void addStrongMessage(PaxosMessage a_msg)
          Adds a StrongMessage.
private  void addWeakMessage(PaxosMessage a_msg)
          Adds a WeakMessage.
private  void cloneMessage(PaxosMessage a_original, PaxosMessage a_target)
          Copies the attributes of the source message to the target message
private  void decide(PaxosRound a_round, PaxosMessage a_msg, boolean a_sendDecide)
          Decide for the proposal contained in the given message and send a DecideMessage to all processes if a_sendDecide is true
private  void freeze(PaxosRound a_round)
          Freezes the given round either if a timeout oocured or if we got more than f FreezeMessages
 PaxosInstance getPaxosInstance(java.lang.String a_paxosInstanceId)
          Returns the PaxosInstance identified by the given id
private  PaxosRound getPaxosRound(PaxosMessage a_msg)
          Returns the PaxosRound to which the given message belongs
protected  java.util.Vector getRoundLeaders()
           
protected abstract  void notifyAgreement(java.util.Hashtable a_agreements)
          Callback for implementing classes.
private  void strongAccept(PaxosRound a_round, PaxosMessage a_msg)
          Strongly accept the proposal contained in the given message an send a StrongMessage to all processes
 void timeout(java.lang.Object m_round)
          Callback method for the PaxosTimeout of a PaxosRound.
private  void weakAccept(PaxosRound a_round, PaxosMessage a_msg)
          Weakly accept the proposal contained in the given message and send a WeakMessage to all processes
 
Methods inherited from class infoservice.agreement.paxos.PaxosProposer
propose, setRound
 
Methods inherited from class infoservice.agreement.paxos.PaxosCommunicator
getF, getIdentifier, getN, getQuorumDecideStrong, getQuorumDecideWeak, getQuorumStrong, getQuorumTwoThird, getTargets, multicast, sendMessage, sendMessage, setTargets
 
Methods inherited from class infoservice.agreement.paxos.PaxosObject
debug, error, fatal, getLog, info, setLog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_paxosInstances

protected java.util.Hashtable m_paxosInstances
A collection of all running PAXOS instances

Constructor Detail

PaxosAcceptor

public PaxosAcceptor()
Method Detail

addMessage

public void addMessage(PaxosMessage a_msg)
This gets called if a PaxosMessage arrives. The handling methods sort the message to the matching instance, execution and round

Parameters:
a_msg - The message to be handled

addCollectMessage

private void addCollectMessage(PaxosMessage a_msg)
Adds a CollectMessage. A CollectMessage contains a new proposal which has to be "good" according to the attached proof, otherwise it will not be accepted

Parameters:
a_msg - The CollectMessage to be handled

addFreezeProofMessage

private void addFreezeProofMessage(PaxosMessage a_msg)
Adds a FreezeProofMessage. A FreezeProofMessage contains the weakly accepted value and the strongly accepted value of the sender in the last round. These values as signed and will be used to compute a "good" proposal for the following round

Parameters:
a_msg - The FreezeProofMessage to be handled

addFreezeMessage

private void addFreezeMessage(PaxosMessage a_msg)
Adds a FreezeMessage. A FreezeMessage is sent by others if their local timeout for the matching round in the matching execution timed out. If we get more than f FreezeMessages we also freeze the round (because within the min f+1 FreezeMessages we received, at least one came frome an honest party)

Parameters:
a_msg - The FreezeMessage to add

addProposeMessage

private void addProposeMessage(PaxosMessage a_msg)
Adds a ProposeMessage. A ProposeMesssage is the first message of each execution. A value is proposed that should be accepted by all parties.

Parameters:
a_msg -

addWeakMessage

private void addWeakMessage(PaxosMessage a_msg)
Adds a WeakMessage. If a process weakly accepts a proposal, it sends a WeakMessage to all the others. It might be that a process doesn't get the matching proposal, so we add the posibility to weakly accept a value if at least f+1 have done so

Parameters:
a_msg - The WeakMessage to be added

addStrongMessage

private void addStrongMessage(PaxosMessage a_msg)
Adds a StrongMessage. A StrongMessage is sent by a process which strongly accepted the proposal.

Parameters:
a_msg - The StrongMessage to be added

addDecideMessage

private void addDecideMessage(PaxosMessage a_msg)
Adds a DecideMessage. DecideMessages are sent if a process decides for the porposal

Parameters:
a_msg - The DecideMessage to be added

weakAccept

private void weakAccept(PaxosRound a_round,
                        PaxosMessage a_msg)
Weakly accept the proposal contained in the given message and send a WeakMessage to all processes

Parameters:
a_round - The round the message belongs to
a_msg - The message which triggered the weak acceptance

cloneMessage

private void cloneMessage(PaxosMessage a_original,
                          PaxosMessage a_target)
Copies the attributes of the source message to the target message

Parameters:
a_original - The source message
a_target - The target message

strongAccept

private void strongAccept(PaxosRound a_round,
                          PaxosMessage a_msg)
Strongly accept the proposal contained in the given message an send a StrongMessage to all processes

Parameters:
a_round - The round the message belongs to
a_msg - The message which triggered the weak acceptance

decide

private void decide(PaxosRound a_round,
                    PaxosMessage a_msg,
                    boolean a_sendDecide)
Decide for the proposal contained in the given message and send a DecideMessage to all processes if a_sendDecide is true

Parameters:
a_round - The round the message belongs to
a_msg - The message which triggered the weak acceptance
a_sendDecide - If true a decide message is sent, otherwise not

freeze

private void freeze(PaxosRound a_round)
Freezes the given round either if a timeout oocured or if we got more than f FreezeMessages

Parameters:
a_round - The round to be frozen

timeout

public void timeout(java.lang.Object m_round)
Callback method for the PaxosTimeout of a PaxosRound. Freezes the round if it hasn't been decided yet

Specified by:
timeout in interface TimeoutListener
Parameters:
m_round -

getPaxosInstance

public PaxosInstance getPaxosInstance(java.lang.String a_paxosInstanceId)
Returns the PaxosInstance identified by the given id

Parameters:
a_paxosInstanceId - The ID of the instance to be returned
Returns:
The PaxosInstance with the given ID

getPaxosRound

private PaxosRound getPaxosRound(PaxosMessage a_msg)
Returns the PaxosRound to which the given message belongs

Parameters:
a_msg - The message used to determine the Round to be returned
Returns:
The PaxosRound to which the given message belongs

getRoundLeaders

protected java.util.Vector getRoundLeaders()

notifyAgreement

protected abstract void notifyAgreement(java.util.Hashtable a_agreements)
Callback for implementing classes. This gets called when agreement has been reached, that means every proposer proposed (which leads to an execution) and every execution has beed decided

Parameters:
a_agreements - Map of execution-identifier to decission