|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object infoservice.agreement.multicast.ConsensusLogEchoMulticast
public class ConsensusLogEchoMulticast
AMessage
s.Field Summary | |
---|---|
private boolean |
m_agreed
Indicates whether the agreement for this log entry is reached. |
private boolean |
m_comitted
Indicates whether the a CommitMessage was send for this
log entry. |
private java.util.Hashtable |
m_commitMessagesHashTable
Holds the accepted CommitMessage s. |
private java.lang.String |
m_consensusId
The consensus log entry id. |
private int |
m_criticalMasses
Holds a value which determines the lower bound of good infoservices. |
private java.util.Hashtable |
m_echoMessagesHashTable
Holds the accepted EchoMessage s. |
private IAgreementHandler |
m_handler
An Instance of the agreement handler to get some information about the current infoservice and for notifying agreements. |
private java.lang.String |
m_initiatorId
The id of the infoservice which send the InitMessag . |
private InitMessage |
m_initMessage
Saves the accepted initial message according to this log entry. |
private java.lang.String |
m_lastCommonRandom
The result of the last agreement or an initalized value at startup which is used as round number too. |
private IAgreementLog |
m_logger
A logger. |
private boolean |
m_rejected
Indicates whether the a RejectMessage was send for this
log entry. |
private java.util.Hashtable |
m_rejectMessagesHashTable
Holds the accepted RejectMessage s. |
private boolean |
m_restarted
Indicates whether the a log entry got enough RejectMessages
to reset the lastCommonRandom and restart the protocol. |
private boolean |
m_timedOut
Indicates whether the a lifecycle for this log entry is expired. |
private TimeoutThread |
timeoutThread
Holds the timeout thread. |
Constructor Summary | |
---|---|
ConsensusLogEchoMulticast(EchoMulticastAgreementHandlerImpl a_handler,
InitMessage a_initMessage)
Constructor for creating a log entry. |
|
ConsensusLogEchoMulticast(EchoMulticastAgreementHandlerImpl a_handler,
InitMessage a_initMessage,
IAgreementLog a_log)
Constructor for creating a logentry. |
|
ConsensusLogEchoMulticast(EchoMulticastAgreementHandlerImpl a_handler,
java.lang.String a_consensusId,
IAgreementLog a_log,
java.lang.String a_initiatorsId)
Constructor for creating a logentry. |
Method Summary | |
---|---|
boolean |
addCommitMessage(CommitMessage a_msg)
If checkCommitMessage(a_msg) is successful the messge will
be added to the consensuslog, otherwise discarded. |
boolean |
addEchoMessage(EchoMessage a_msg)
If checkEchoMessage(a_msg) is successful the messge will
be added to the consensuslog, otherwise discarded. |
boolean |
addInitMessage(InitMessage a_msg)
If checkInitMessage(a_msg) was successful the messge will
be added to the consensuslog, otherwise discarded. |
void |
addRejectMessage(RejectMessage a_msg)
If checkRejectMessage(a_msg) is successful the messge will
be added to the consensuslog, otherwise discarded. |
private boolean |
checkCommitMessage(CommitMessage a_msg)
Checks the given CommitMessage. |
private boolean |
checkEchoMessage(EchoMessage a_msg)
Checks the given EchoMessage. |
private boolean |
checkGenericMessage(AMessage a_msg)
Check the properties encapsulated in the AMessage super
class. |
private boolean |
checkInitMessage(InitMessage a_msg)
Checks the given InitMessage AND sets the ConsensusId. |
private void |
checkRejectMajority(RejectMessage a_msg)
Count the number of received RejectMessage and sets this
value to sm_lastCommonRandom if the amount reachs at least
m_criticalMasses . |
private boolean |
checkRejectMessage(RejectMessage a_msg)
Check the given reject-message and, if positive, extract and save the new value of lastCommonRandom |
private void |
debug(java.lang.String a_message)
|
int |
getCommitMessageCount()
Get the hashtable which holds the accepted CommitMessage s. |
java.lang.String |
getConsensusID()
Gets the consensus log entry id. |
int |
getEchoMessageCount()
Count the EchoMessage s. |
java.lang.String |
getInitiatorId()
Gets the id of the infoservice which send the InitMessag . |
InitMessage |
getInitMessages()
Gets the accepted initial message according to this log entry. |
java.lang.String |
getLastCommonRandom()
Gets the result of the last agreement or an initalized value at start up which is used as round number too. |
private void |
initializeConsensusLog(EchoMulticastAgreementHandlerImpl a_handler,
java.lang.String a_consensusId,
IAgreementLog a_log,
java.lang.String a_initiatorsId)
Sets up the necessary start variables. |
boolean |
isAgreed()
Indicates whether the agreement for this log entry is reached. |
boolean |
isComitted()
Indicates whether the a CommitMessage was send for this
log entry. |
boolean |
isRejected()
Indicates whether the a RejectMessage was send for this
log entry. |
boolean |
isRestarted()
Indicates whether the a log entry got enough RejectMessages
to reset the lastCommonRandom and restart the protocol. |
private void |
putter(java.util.Hashtable amounts,
RejectMessage msg)
Counts the received RejectMessages . |
void |
setAgreed(boolean agreed)
Indicates whether the agreement for this log entry is reached. |
void |
setComitted(boolean comitted)
Set a value which indicates whether the a CommitMessage
was send for this log entry. |
void |
setRestarted(boolean a_restarted)
Sets a value which indicates whether the a log entry got enough RejectMessages to reset the lastCommonRandom
and restart the protocol. |
void |
stopTimeout()
Stops the consensus log time out. |
void |
timeout(java.lang.Object a_value)
On creating a consensuslog a timer will be set. |
CommitMessage |
tryToCreateACommitMessage()
Check the criteria for creating a CommitMessage an do it if possible. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private InitMessage m_initMessage
private java.util.Hashtable m_echoMessagesHashTable
EchoMessage
s.
private java.util.Hashtable m_commitMessagesHashTable
CommitMessage
s.
private java.util.Hashtable m_rejectMessagesHashTable
RejectMessage
s.
private IAgreementLog m_logger
private boolean m_agreed
private boolean m_comitted
CommitMessage
was send for this
log entry.
private boolean m_timedOut
private TimeoutThread timeoutThread
private IAgreementHandler m_handler
private java.lang.String m_consensusId
private int m_criticalMasses
private java.lang.String m_initiatorId
InitMessag
.
private boolean m_rejected
RejectMessage
was send for this
log entry.
private boolean m_restarted
RejectMessages
to reset the lastCommonRandom
and restart the protocol.
private java.lang.String m_lastCommonRandom
Constructor Detail |
---|
public ConsensusLogEchoMulticast(EchoMulticastAgreementHandlerImpl a_handler, InitMessage a_initMessage)
a_handler
- The corrosponding agreementhandler.a_initMessage
- Initmessage. This ist the startmessage of the protocol.public ConsensusLogEchoMulticast(EchoMulticastAgreementHandlerImpl a_handler, java.lang.String a_consensusId, IAgreementLog a_log, java.lang.String a_initiatorsId)
a_handler
- The corrosponding agreementhandler.a_consensusId
- The id of this consensuslogentry.a_log
- A filelogger.public ConsensusLogEchoMulticast(EchoMulticastAgreementHandlerImpl a_handler, InitMessage a_initMessage, IAgreementLog a_log)
a_handler
- The corrosponding agreementhandler.a_initMessage
- Initmessage. This ist the startmessage of the protocol.a_log
- A filelogger.Method Detail |
---|
private void initializeConsensusLog(EchoMulticastAgreementHandlerImpl a_handler, java.lang.String a_consensusId, IAgreementLog a_log, java.lang.String a_initiatorsId)
a_handler
- a_consensusId
- a_log
- a_initiatorsId
- private boolean checkGenericMessage(AMessage a_msg)
AMessage
super
class.
a_msg
- The message.
true
if successful.public boolean addInitMessage(InitMessage a_msg)
checkInitMessage(a_msg)
was successful the messge will
be added to the consensuslog, otherwise discarded.
a_msg
- The message.private boolean checkInitMessage(InitMessage a_msg)
a_msg
-
public boolean addEchoMessage(EchoMessage a_msg)
checkEchoMessage(a_msg)
is successful the messge will
be added to the consensuslog, otherwise discarded.
a_msg
- The message.private boolean checkEchoMessage(EchoMessage a_msg)
a_msg
-
public boolean addCommitMessage(CommitMessage a_msg)
checkCommitMessage(a_msg)
is successful the messge will
be added to the consensuslog, otherwise discarded.
a_msg
- The message.private boolean checkCommitMessage(CommitMessage a_msg)
a_msg
-
public void addRejectMessage(RejectMessage a_msg)
checkRejectMessage(a_msg)
is successful the messge will
be added to the consensuslog, otherwise discarded.
a_msg
- The message.private boolean checkRejectMessage(RejectMessage a_msg)
lastCommonRandom
a_msg
- The message.
private void checkRejectMajority(RejectMessage a_msg)
RejectMessage
and sets this
value to sm_lastCommonRandom
if the amount reachs at least
m_criticalMasses
.
private void putter(java.util.Hashtable amounts, RejectMessage msg)
RejectMessages
.
amounts
- A hashtable which contains the various
RejectMessage
s.msg
- The message.public CommitMessage tryToCreateACommitMessage()
public int getEchoMessageCount()
EchoMessage
s.
EchoMessage
s.public int getCommitMessageCount()
CommitMessage
s.
public boolean isAgreed()
isAgreed
in interface IConsensusLog
true
if an agreement has been reached,
false
otherwisepublic void setAgreed(boolean agreed)
setAgreed
in interface IConsensusLog
agreed
- The new valuepublic boolean isComitted()
CommitMessage
was send for this
log entry.
isComitted
in interface IConsensusLog
true
if so, otherwise false
.public void setComitted(boolean comitted)
CommitMessage
was send for this log entry.
setComitted
in interface IConsensusLog
comitted
- The new statuspublic void stopTimeout()
stopTimeout
in interface IConsensusLog
public java.lang.String getConsensusID()
getConsensusID
in interface IConsensusLog
public InitMessage getInitMessages()
public java.lang.String getInitiatorId()
InitMessag
.
getInitiatorId
in interface IConsensusLog
public boolean isRejected()
RejectMessage
was send for this
log entry.
isRejected
in interface IConsensusLog
true
if so, otherwise false
.public java.lang.String getLastCommonRandom()
getLastCommonRandom
in interface IConsensusLog
public boolean isRestarted()
RejectMessages
to reset the lastCommonRandom
and restart the protocol.
true
if so, otherwise false
.public void setRestarted(boolean a_restarted)
RejectMessages
to reset the lastCommonRandom
and restart the protocol.
a_restarted
- private void debug(java.lang.String a_message)
public void timeout(java.lang.Object a_value)
timeout
in interface TimeoutListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |