infoservice.agreement.paxos
Class PaxosRound

java.lang.Object
  extended by infoservice.agreement.paxos.PaxosObject
      extended by infoservice.agreement.paxos.PaxosRound

public class PaxosRound
extends PaxosObject


Field Summary
private  boolean m_aborted
           
private  boolean m_collected
           
private  java.lang.String m_decided
           
private  java.util.Hashtable m_decideMessages
           
private  PaxosExecution m_execution
           
private  boolean m_freezed
           
private  java.util.Vector m_freezeMessages
           
private  java.util.Vector m_freezeProofMessages
           
private  java.lang.String m_leaderId
           
private  PaxosMessage m_proposal
           
private  int m_roundNumber
           
private  java.lang.String m_strongAccepted
           
private  java.util.Hashtable m_strongMessages
           
private  TimeoutThread m_timeout
           
private  java.lang.String m_weakAccepted
           
private  java.util.Hashtable m_weakMessages
           
 
Constructor Summary
PaxosRound(PaxosExecution a_execution, int a_round, java.lang.String a_leaderId)
          Creates a new PaxosRound within the given PaxosExecution with the given round number and the given leaderId
 
Method Summary
 void abort()
          Aborts this round
 boolean acc(java.lang.String a_proposal)
          Calculates if the given proposal belongs to the set Acc (see Paxos at War)
 boolean addCollectMessage(CollectMessage a_msg)
          Adds a CollectMessage to this round.
 boolean addDecideMessage(PaxosMessage a_msg)
          Adds a DecideMessage to this round
 boolean addFreezeMessage(PaxosMessage a_msg)
          Adds a FreezeMessage to this round
private  boolean addMessage(java.util.Hashtable a_messages, PaxosMessage a_msg)
          Does some message checking and then adds the given message to the given hashtable
 boolean addProof(FreezeProofMessage a_msg)
          Adds a FreezeProofMessage to this round.
 boolean addProposal(PaxosMessage a_msg)
          Adds a proposal for tihs round
 boolean addStrongMessage(PaxosMessage a_msg)
          Adds a StrongMessage to this round
 boolean addWeakMessage(PaxosMessage a_msg)
          Adds a WeakMessage to this round
 void decide(java.lang.String a_proposal)
          Decides on the given value.
 void freeze()
          Freezes this round.
 java.util.Vector getAcc()
          Returns the set Acc for this round
 int getDecideMessageCount(java.lang.String a_proposal)
          Returns the number of decide-messages received for the given proposal
 PaxosExecution getExecution()
          Returns the PaxosExecution this round belongs to
 int getFreezeMessageCount()
          Returns the nunmber of totally received freeze messages
 int getFreezeProofMessageCount()
          Returns the number of FreezeProofMessages received in this round
 java.util.Vector getFreezeProofs()
          Returns the FreezeProofMessages for tihs round
 java.lang.String getLeaderId()
          Returns the ID of the leader of thi round
 java.util.Vector getPoss()
          Returns the set Poss for this round
 int getRoundNumber()
          Returns the round number of this round
 java.lang.String getStrongAccepted()
          Returns the value which has been strongly accepted
 int getStrongMessageCount(java.lang.String a_proposal)
          Returns the number of strong-messages received for the given proposal
 int getTotalDecideMessageCount()
          Returns the nunmber of totally received decide messages
 java.lang.String getWeakAccepted()
          Returns the value which has been weakly accepted
 int getWeakMessageCount(java.lang.String a_proposal)
          Returns the number of weak-messages received for the given proposal
 boolean isAborted()
          Indicates if this round has been aborted
 boolean isDecided()
          Indicates of this round has been decided
 boolean isFrozen()
          Indicates if this round has been frozen
 boolean isGood(java.lang.String a_value)
          Indicates if the given value is "good" (see Paxos at War)
 boolean isStrongAccepted()
          Indicates if we have strongly accepted a proposal in this round
 boolean isWeakAccepted()
          Indicates if there is a weakly accepted value for this round
 boolean poss(java.lang.String a_proposal)
          Calculates if the given proposal belongs to the set Poss (see Paxos at War)
 void strongAccept(java.lang.String a_proposal)
          Strongly accepts the given proposal
 void weakAccept(java.lang.String a_proposal)
          Weakly accepts the given proposal
 
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_timeout

private TimeoutThread m_timeout

m_proposal

private PaxosMessage m_proposal

m_weakMessages

private java.util.Hashtable m_weakMessages

m_strongMessages

private java.util.Hashtable m_strongMessages

m_decideMessages

private java.util.Hashtable m_decideMessages

m_freezeMessages

private java.util.Vector m_freezeMessages

m_freezeProofMessages

private java.util.Vector m_freezeProofMessages

m_execution

private PaxosExecution m_execution

m_weakAccepted

private java.lang.String m_weakAccepted

m_strongAccepted

private java.lang.String m_strongAccepted

m_freezed

private boolean m_freezed

m_roundNumber

private int m_roundNumber

m_leaderId

private java.lang.String m_leaderId

m_decided

private java.lang.String m_decided

m_collected

private boolean m_collected

m_aborted

private boolean m_aborted
Constructor Detail

PaxosRound

public PaxosRound(PaxosExecution a_execution,
                  int a_round,
                  java.lang.String a_leaderId)
Creates a new PaxosRound within the given PaxosExecution with the given round number and the given leaderId

Parameters:
a_execution - The PaxosExecution this round belongs to
a_round - The round number
a_leaderId - The leaders id
Method Detail

getLeaderId

public java.lang.String getLeaderId()
Returns the ID of the leader of thi round

Returns:
The ID of the leader of thi round

getRoundNumber

public int getRoundNumber()
Returns the round number of this round

Returns:
The round number of this round

addProposal

public boolean addProposal(PaxosMessage a_msg)
Adds a proposal for tihs round

Parameters:
a_msg - The ProposeMessage to be added
Returns:
true if the message could be added, false otherwise

getExecution

public PaxosExecution getExecution()
Returns the PaxosExecution this round belongs to

Returns:
The PaxosExecution this round belongs to

addWeakMessage

public boolean addWeakMessage(PaxosMessage a_msg)
Adds a WeakMessage to this round

Parameters:
a_msg - The message to be added
Returns:
true if the message could be added, false otherwise

addStrongMessage

public boolean addStrongMessage(PaxosMessage a_msg)
Adds a StrongMessage to this round

Parameters:
a_msg - The message to be added
Returns:
true if the message could be added, false otherwise

addDecideMessage

public boolean addDecideMessage(PaxosMessage a_msg)
Adds a DecideMessage to this round

Parameters:
a_msg - The message to be added
Returns:
true if the message could be added, false otherwise

addFreezeMessage

public boolean addFreezeMessage(PaxosMessage a_msg)
Adds a FreezeMessage to this round

Parameters:
a_msg - The message to be added
Returns:
true if the message could be added, false otherwise

weakAccept

public void weakAccept(java.lang.String a_proposal)
Weakly accepts the given proposal

Parameters:
a_proposal - The proposal to be weakly accepted

strongAccept

public void strongAccept(java.lang.String a_proposal)
Strongly accepts the given proposal

Parameters:
a_proposal - The proposal to be strongly accepted

getWeakAccepted

public java.lang.String getWeakAccepted()
Returns the value which has been weakly accepted

Returns:
The value which has been weakly accepted

getStrongAccepted

public java.lang.String getStrongAccepted()
Returns the value which has been strongly accepted

Returns:
he value which has been strongly accepted

isWeakAccepted

public boolean isWeakAccepted()
Indicates if there is a weakly accepted value for this round

Returns:
true if there is a weakly accepted value for this round, false otherwise

getWeakMessageCount

public int getWeakMessageCount(java.lang.String a_proposal)
Returns the number of weak-messages received for the given proposal

Parameters:
a_proposal - The proposal to be checked
Returns:
The number of weak-messages received for the given proposal

getStrongMessageCount

public int getStrongMessageCount(java.lang.String a_proposal)
Returns the number of strong-messages received for the given proposal

Parameters:
a_proposal - The proposal to be checked
Returns:
The number of strong-messages received for the given proposal

getDecideMessageCount

public int getDecideMessageCount(java.lang.String a_proposal)
Returns the number of decide-messages received for the given proposal

Parameters:
a_proposal - The proposal to be checked
Returns:
The number of decide-messages received for the given proposal

getTotalDecideMessageCount

public int getTotalDecideMessageCount()
Returns the nunmber of totally received decide messages

Returns:
he nunmber of totally received decide messages

getFreezeMessageCount

public int getFreezeMessageCount()
Returns the nunmber of totally received freeze messages

Returns:
he nunmber of totally received freeze messages

addMessage

private boolean addMessage(java.util.Hashtable a_messages,
                           PaxosMessage a_msg)
Does some message checking and then adds the given message to the given hashtable

Parameters:
a_messages - The message to be added
a_msg - The hashtable the message should be added to
Returns:
true if the message has been added, false otherwise

decide

public void decide(java.lang.String a_proposal)
Decides on the given value. This makes the execution decide too and the timeout for this round is canceled

Parameters:
a_proposal - The proposal to decide to

isDecided

public boolean isDecided()
Indicates of this round has been decided

Returns:
true if we decided for a proposal, false otherwise

isStrongAccepted

public boolean isStrongAccepted()
Indicates if we have strongly accepted a proposal in this round

Returns:
true if we strongly accepted a proposal in this round, false otherwise

freeze

public void freeze()
Freezes this round. Timeout is canceled


isFrozen

public boolean isFrozen()
Indicates if this round has been frozen

Returns:
true if the round is frozen, false otherwise

addProof

public boolean addProof(FreezeProofMessage a_msg)
Adds a FreezeProofMessage to this round.

Parameters:
a_msg - The FreezeProofMessage to be added
Returns:
true if the message has been added, false otherwise

getFreezeProofMessageCount

public int getFreezeProofMessageCount()
Returns the number of FreezeProofMessages received in this round

Returns:
The number of FreezeProofMessages received in this round

acc

public boolean acc(java.lang.String a_proposal)
Calculates if the given proposal belongs to the set Acc (see Paxos at War)

Parameters:
a_proposal - The proposal to check

getAcc

public java.util.Vector getAcc()
Returns the set Acc for this round

Returns:
The set Acc for this round

getPoss

public java.util.Vector getPoss()
Returns the set Poss for this round

Returns:
The set Poss for this round

poss

public boolean poss(java.lang.String a_proposal)
Calculates if the given proposal belongs to the set Poss (see Paxos at War)

Parameters:
a_proposal - The proposal to check

isGood

public boolean isGood(java.lang.String a_value)
Indicates if the given value is "good" (see Paxos at War)

Parameters:
a_value - The value to be tested
Returns:
true if the given value is "good", false otherwise

getFreezeProofs

public java.util.Vector getFreezeProofs()
Returns the FreezeProofMessages for tihs round

Returns:
A vector containing the FreezeProofMessages of this round

addCollectMessage

public boolean addCollectMessage(CollectMessage a_msg)
Adds a CollectMessage to this round.

Parameters:
a_msg - The CollectMessage to be added
Returns:
true if the message has been added, false otherwise

isAborted

public boolean isAborted()
Indicates if this round has been aborted

Returns:
true if this round has been aborted, false otherwise

abort

public void abort()
Aborts this round