|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object infoservice.agreement.multicast.EchoMulticastAgreementHandlerImpl
public class EchoMulticastAgreementHandlerImpl
Field Summary | |
---|---|
private TimeoutThread |
m_agreementTimeOutThread
A thread used for giving time out signal. |
private boolean |
m_agreementTimeoutThreadIsStarted
Determines whether the agreement time out thrtead is just started. |
private CommitmentMessage |
m_commitmentMessage
The CommitmentMessage is not a part of the reliable broadcast protocol. |
private java.util.Hashtable |
m_currentAgreementResults
Contains the reached agreement results (from infoservice1, infoservice2 ...) of the current phase. |
protected java.lang.String |
m_currentMessage
This is the current massage (proposal) which is actual performed by the agreement protocol. |
private int |
m_currentPhase
Indicates the current phase of the commitment scheme. |
private IInfoService |
m_infoService
The infoservice we are bundled. |
private java.lang.String |
m_lastCommonRandom
Holds the last agreed random number or an init value at start up. |
private IAgreementLog |
m_logger
A little logger to write out log informations to filesystem. |
private java.util.Hashtable |
m_logHashTable
Saves the log entries which hold the checked messages. |
private java.util.Hashtable |
m_phaseOneAgreemetResults
Contains the reached agreement results of agreement phase one. |
Constructor Summary | |
---|---|
EchoMulticastAgreementHandlerImpl(IInfoService a_infoService)
Creates an agereement handler witch runs the multycast-agreement-protocol. |
Method Summary | |
---|---|
private java.lang.Long |
checkTheResults()
Evaluate the results, combine the random numbers of all infoservices and return this new common random value or null. |
private void |
debug(java.lang.String a_message)
Logs debug messages |
private ConsensusLogEchoMulticast |
getConsensusLog(AMessage a_msg)
Gets the appropriate consensus log entry by consensus id or, if not yet in the store, creates a new one and adds is to the store. |
IInfoService |
getInfoService()
Gets the infoservice which belongs to this agreement handler. |
java.lang.String |
getLastCommonRandom()
Gets he value which holds the last agreed random number or an init value at start up. |
private void |
handleCommitMessage(CommitMessage a_message)
Check and add a CommitMessage. |
private void |
handleConfirmationMessage(ConfirmationMessage a_message)
This method handles all incomming confirmation-messages. |
private void |
handleEchoMessage(EchoMessage a_message)
If an EchoMessage received, it will be handled by two steps. |
private void |
handleInitMessage(InitMessage a_message)
If an InitMessage received, it will be handled by two steps. |
void |
handleMessage(IAgreementMessage a_msg)
This is the main handle point for incomming messages according to this agreement protocol. |
private void |
handleRejectMessage(RejectMessage a_message)
This method handles all incomming reject-messages. |
(package private) void |
info(java.lang.String a_message)
Logs info messages |
private void |
notifyBabylonianConfusion()
If something really really bad happens, that is if the InfoServices massively disagree, we need help |
void |
notifyConsensusLogTimeout(IConsensusLog consensus)
This method is called by the ConsensusLogTimeoutThread at
the moment of expiration. |
void |
reset()
Initialize some variables and reset the time out thread. |
protected void |
sendReliableBroadcastMessage(java.lang.String a_message)
Starts the reliable broadcast and performs the given message. |
void |
setLastCommonRandom(java.lang.String commonRandom)
This is needes for testing purposes only. |
void |
setLog(IAgreementLog a_log)
|
void |
softReset()
Initialize some variables and reset the time out thread. |
void |
startAgreementCommitmentProtocol()
Call this methode to initialize the agreement protocol. |
void |
timeout(java.lang.Object a_value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.Hashtable m_currentAgreementResults
private java.util.Hashtable m_phaseOneAgreemetResults
private IInfoService m_infoService
private IAgreementLog m_logger
private java.lang.String m_lastCommonRandom
private java.util.Hashtable m_logHashTable
private TimeoutThread m_agreementTimeOutThread
private CommitmentMessage m_commitmentMessage
protected java.lang.String m_currentMessage
private boolean m_agreementTimeoutThreadIsStarted
private int m_currentPhase
Constructor Detail |
---|
public EchoMulticastAgreementHandlerImpl(IInfoService a_infoService)
a_infoService
- The infoservice belongs to.Method Detail |
---|
public void handleMessage(IAgreementMessage a_msg) throws java.lang.IllegalArgumentException
handleMessage
in interface IAgreementHandler
a_msg
- The incomming message.
java.lang.IllegalArgumentException
private void handleConfirmationMessage(ConfirmationMessage a_message)
CommitMessage if no agreement is reached yet and perform
handleCommitMessage(..).
- Parameters:
a_message
- The message.
private void handleRejectMessage(RejectMessage a_message)
lastCommonRandom
.
a_message
- The message.private void handleInitMessage(InitMessage a_message)
a_message
- The InitMessage.private void handleEchoMessage(EchoMessage a_message)
a_message
- the EchoMessageprivate void handleCommitMessage(CommitMessage a_message)
a_message
- The messagepublic void startAgreementCommitmentProtocol()
startAgreementCommitmentProtocol
in interface IAgreementHandler
lastRandom
- Should be the common random number from the las agreement or
an initial value shared by all infoservices.protected void sendReliableBroadcastMessage(java.lang.String a_message)
a_message
- The message to send.public void reset()
reset
in interface IAgreementHandler
public void softReset()
private ConsensusLogEchoMulticast getConsensusLog(AMessage a_msg)
a_msg
- The message, which contains all informations to construct a
log id.
public void notifyConsensusLogTimeout(IConsensusLog consensus)
ConsensusLogTimeoutThread
at
the moment of expiration.
notifyConsensusLogTimeout
in interface IAgreementHandler
consensus
- The log entry.private void notifyBabylonianConfusion()
private java.lang.Long checkTheResults()
public java.lang.String getLastCommonRandom()
public void setLastCommonRandom(java.lang.String commonRandom)
IAgreementHandler
setLastCommonRandom
in interface IAgreementHandler
commonRandom
- The value of the current round number.private void debug(java.lang.String a_message)
a_message
- The message to log.void info(java.lang.String a_message)
a_message
- public IInfoService getInfoService()
IAgreementHandler
getInfoService
in interface IAgreementHandler
public void timeout(java.lang.Object a_value)
timeout
in interface TimeoutListener
public void setLog(IAgreementLog a_log)
setLog
in interface IAgreementHandler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |