infoservice.agreement.paxos.integration
Class InfoServicePaxosAdapter

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
                  extended by infoservice.agreement.paxos.integration.PaxosAdapter
                      extended by infoservice.agreement.paxos.integration.InfoServicePaxosAdapter
All Implemented Interfaces:
TimeoutListener, IInfoServiceAgreementAdapter

public class InfoServicePaxosAdapter
extends PaxosAdapter
implements IInfoServiceAgreementAdapter

Author:
ss1

Nested Class Summary
 
Nested classes/interfaces inherited from class infoservice.agreement.paxos.integration.PaxosAdapter
PaxosAdapter.AgreementStarterThread
 
Field Summary
private  DynamicCascadeConfigurator m_dynamicMixConfigurator
          A cascade configurator which holds logic for wireing mixes to cascades.
(package private)  InfoServiceDBEntry m_self
           
 
Fields inherited from class infoservice.agreement.paxos.integration.PaxosAdapter
m_commitments, m_currentState, m_ownCommitment, m_passivelyReceivedMessages, m_potentialyCorrectMessage, m_starterThread
 
Fields inherited from class infoservice.agreement.paxos.PaxosAcceptor
m_paxosInstances
 
Fields inherited from class infoservice.agreement.paxos.PaxosProposer
m_lastRandom
 
Fields inherited from class infoservice.agreement.paxos.PaxosCommunicator
m_targets
 
Constructor Summary
InfoServicePaxosAdapter()
          Creates a new InfoServicePaxosAdapter and prepares for the first agreement
 
Method Summary
(package private)  InfoServiceDBEntry generateInfoServiceSelf()
          Generates an InfoServiceDBEntry for this InfoService
protected  java.lang.String getIdentifier()
          Returns the unique identifier for this PaxosCommunicator
 HttpResponseStructure handleMessage(byte[] a_postData)
          Handles the given POST data
 void multicast(PaxosMessage a_msg)
          Multicasts the given message to all known IPaxosTargets.
protected  void prepareTargets()
           
 void sendMessage(PaxosMessage a_msg, IPaxosTarget a_target)
          Sends the given message to the given target.
protected  boolean sendToInfoService(InfoServiceDBEntry a_infoservice, IDistributable a_message)
          Encapsulates logic for sending a message to a infoservice.
private  boolean sendToInterface(ListenerInterface a_listener, IDistributable a_message)
          Encapsulates logic for sending a message to a specified listenere interface.
protected  void useAgreement(long a_agreement)
          What shall we do with an agreement? You can define it here
 
Methods inherited from class infoservice.agreement.paxos.integration.PaxosAdapter
handleIncommingMessage, handleMessage, notifyAgreement, notifyReject, roundNrAcceptable, senderNotInSnapshot, sendReject, startAgreement, startPassivePhase, startProtocolByOperator, startRound
 
Methods inherited from class infoservice.agreement.paxos.PaxosAcceptor
addMessage, getPaxosInstance, getRoundLeaders, timeout
 
Methods inherited from class infoservice.agreement.paxos.PaxosProposer
propose, setRound
 
Methods inherited from class infoservice.agreement.paxos.PaxosCommunicator
getF, getN, getQuorumDecideStrong, getQuorumDecideWeak, getQuorumStrong, getQuorumTwoThird, getTargets, 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
 
Methods inherited from interface infoservice.agreement.IInfoServiceAgreementAdapter
startProtocolByOperator
 

Field Detail

m_dynamicMixConfigurator

private DynamicCascadeConfigurator m_dynamicMixConfigurator
A cascade configurator which holds logic for wireing mixes to cascades. He uses the agreement result, the common random number, to do that.


m_self

InfoServiceDBEntry m_self
Constructor Detail

InfoServicePaxosAdapter

public InfoServicePaxosAdapter()
Creates a new InfoServicePaxosAdapter and prepares for the first agreement

Method Detail

prepareTargets

protected void prepareTargets()
Specified by:
prepareTargets in class PaxosAdapter

generateInfoServiceSelf

InfoServiceDBEntry generateInfoServiceSelf()
Generates an InfoServiceDBEntry for this InfoService

Returns:
The InfoServiceDBEntry

handleMessage

public HttpResponseStructure handleMessage(byte[] a_postData)
Handles the given POST data

Specified by:
handleMessage in interface IInfoServiceAgreementAdapter
Parameters:
a_postData - The POST data to be handled
Returns:
OK every time

getIdentifier

protected java.lang.String getIdentifier()
Description copied from class: PaxosCommunicator
Returns the unique identifier for this PaxosCommunicator

Specified by:
getIdentifier in class PaxosCommunicator
Returns:
The unique identifier for this PaxosCommunicator

sendMessage

public void sendMessage(PaxosMessage a_msg,
                        IPaxosTarget a_target)
Description copied from class: PaxosCommunicator
Sends the given message to the given target.

Specified by:
sendMessage in class PaxosCommunicator

sendToInfoService

protected boolean sendToInfoService(InfoServiceDBEntry a_infoservice,
                                    IDistributable a_message)
Encapsulates logic for sending a message to a infoservice.

Parameters:
a_infoservice - The target infoservice.
postFile -
postData -
Returns:
Success if true.

sendToInterface

private boolean sendToInterface(ListenerInterface a_listener,
                                IDistributable a_message)
Encapsulates logic for sending a message to a specified listenere interface.

Parameters:
a_listener - The network interface.
postFile -
postData -
Returns:
Success if true.

useAgreement

protected void useAgreement(long a_agreement)
Description copied from class: PaxosAdapter
What shall we do with an agreement? You can define it here

Specified by:
useAgreement in class PaxosAdapter

multicast

public void multicast(PaxosMessage a_msg)
Description copied from class: PaxosCommunicator
Multicasts the given message to all known IPaxosTargets. Uses sendMessage

Overrides:
multicast in class PaxosCommunicator
Parameters:
a_msg - The message to multicast