infoservice.agreement.paxos
Class PaxosCommunicator

java.lang.Object
  extended by infoservice.agreement.paxos.PaxosObject
      extended by infoservice.agreement.paxos.PaxosCommunicator
Direct Known Subclasses:
PaxosProposer

public abstract class PaxosCommunicator
extends PaxosObject


Field Summary
protected  java.util.Hashtable m_targets
           
 
Constructor Summary
PaxosCommunicator()
           
 
Method Summary
protected  int getF()
          Returns f, the number of maximum tolerable faulty processes
protected abstract  java.lang.String getIdentifier()
          Returns the unique identifier for this PaxosCommunicator
 int getN()
          Returns n, the number of all known processes
protected  int getQuorumDecideStrong()
          Returns the quorum needed to decide if a proposal has been strong-accepted (2f)
protected  int getQuorumDecideWeak()
          Gets the quorum needed to fast decide (n+3f)/2
protected  int getQuorumStrong()
          Returns the quorum needed to strong-accept a value: (n+f)/2
 int getQuorumTwoThird()
           
 java.util.Hashtable getTargets()
          Returns the Hashtable of all known targets
 void multicast(PaxosMessage a_msg)
          Multicasts the given message to all known IPaxosTargets.
private  int nextLower(double a_roof)
          Returns the next lower integer for the given double
private  int nextUpper(double a_bottom)
          Returns the next larger integer to the given double
abstract  void sendMessage(PaxosMessage a_msg, IPaxosTarget a_target)
          Sends the given message to the given target.
 void sendMessage(java.lang.String a_id, PaxosMessage a_msg)
          Sends the given message to the IPaxosTarget with the given ID
 void setTargets(java.util.Hashtable a_targets)
          Sets the targets, i.e.
 
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_targets

protected java.util.Hashtable m_targets
Constructor Detail

PaxosCommunicator

public PaxosCommunicator()
Method Detail

multicast

public void multicast(PaxosMessage a_msg)
Multicasts the given message to all known IPaxosTargets. Uses sendMessage

Parameters:
a_msg - The message to multicast

sendMessage

public void sendMessage(java.lang.String a_id,
                        PaxosMessage a_msg)
Sends the given message to the IPaxosTarget with the given ID

Parameters:
a_id - The ID of the IPaxosTarget to which to send
a_msg - The message to send

getTargets

public java.util.Hashtable getTargets()
Returns the Hashtable of all known targets

Returns:
The Hashtable of all known targets

getQuorumStrong

protected int getQuorumStrong()
Returns the quorum needed to strong-accept a value: (n+f)/2

Returns:
The quorum needed to strong-accept a value: (n+f)/2

getQuorumDecideWeak

protected int getQuorumDecideWeak()
Gets the quorum needed to fast decide (n+3f)/2

Returns:
The quorum needed to fast decide (n+3f)/2

getQuorumDecideStrong

protected int getQuorumDecideStrong()
Returns the quorum needed to decide if a proposal has been strong-accepted (2f)

Returns:
The quorum needed to decide if a proposal has been strong-accepted (2f)

getF

protected int getF()
Returns f, the number of maximum tolerable faulty processes

Returns:
f, the number of maximum tolerable faulty processes

getN

public int getN()
Returns n, the number of all known processes

Returns:

getQuorumTwoThird

public int getQuorumTwoThird()

setTargets

public void setTargets(java.util.Hashtable a_targets)
Sets the targets, i.e. known other participants

Parameters:
a_targets - A Vector containing IPaxosTargets

nextUpper

private int nextUpper(double a_bottom)
Returns the next larger integer to the given double

Parameters:
a_bottom -
Returns:

nextLower

private int nextLower(double a_roof)
Returns the next lower integer for the given double

Parameters:
a_roof - The double
Returns:
The next lower integer

sendMessage

public abstract void sendMessage(PaxosMessage a_msg,
                                 IPaxosTarget a_target)
Sends the given message to the given target.

Parameters:
a_msg -
a_target -

getIdentifier

protected abstract java.lang.String getIdentifier()
Returns the unique identifier for this PaxosCommunicator

Returns:
The unique identifier for this PaxosCommunicator