|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectinfoservice.agreement.multicast.AbstractEMCAdapter
public abstract class AbstractEMCAdapter
| Field Summary | |
|---|---|
private boolean |
doNotHandleAnything
LERNGRUPPE A boolean value, which indicates whether the handler is in stop mode. |
protected boolean |
m_activeAgreementStarted
LERNGRUPPE A boolean value, which indicates whether an agreement is started yet. |
protected IAgreementHandler |
m_agreementHandler
LERNGRUPPE The agreement handler. |
private boolean |
m_beInPassiveMode
LERNGRUPPE A boolean value, which indicates whether an agreement is in passive mode yet. |
protected IAgreementLog |
m_log
LERNGRUPPE A logger. |
private boolean |
m_mustBeRestartedForSecurityReason
LERNGRUPPE A boolean value, which indicates whether the handler have to restart the protocol. |
| Constructor Summary | |
|---|---|
AbstractEMCAdapter(IAgreementLog a_log)
LERNGRUPPE The constructor sets only the logger. |
|
| Method Summary | |
|---|---|
protected abstract void |
buildCascades(long l)
Start to build the new cascades. |
protected void |
debug(java.lang.String a_msg)
Loggs a debug message. |
protected void |
error(java.lang.String a_msg)
Loggs a error message. |
protected void |
fatal(java.lang.String a_msg)
Loggs a fatal message. |
abstract java.lang.String |
getIdentifier()
Returns an unique identifier for this IInfoService |
IAgreementLog |
getLog()
Gets the current logger. |
abstract int |
getNumberOfAllInfoservices()
Returns the number of known InfoServices |
void |
handleMessage(IAgreementMessage a_msg)
LERNGRUPPE Handle incomming messages. |
protected void |
info(java.lang.String a_msg)
Loggs a info message. |
abstract void |
multicastMessage(IAgreementMessage a_message)
Multicasts the given message to all known InfoServices (except this one) |
void |
notifyAgreement(java.lang.Long a_oldCommonRandomSeed,
java.lang.Long a_newCommonRandomSeed)
LERNGRUPPE This gets called when the AgreementHandler has reached angreement with the others. |
protected abstract void |
prepareStart()
This method is called in startAgreementCommitmentProtocol()
befor the call will be delegated. |
private void |
reset()
Resets the state variables. |
private void |
restartAgreement()
LERNGRUPPE Some times a restart of the protocol is necessary. |
abstract void |
sendMessageTo(java.lang.String a_id,
IAgreementMessage a_message)
Sends the given message to the InfoService with the given ID |
void |
setIAgreementHandler(IAgreementHandler p_agreementhandler)
Sets the given AgreementHandler. |
void |
setLog(IAgreementLog a_log)
Set the Logger. |
void |
startAdapter()
LERNGRUPPE Call this method to start the adapter. |
protected void |
startAgreementCommitmentProtocol()
LERNGRUPPE Starts the protocol after checking some status values for security reasons. |
protected abstract void |
startListening()
Initialize the message queue handler thread. |
void |
startListeningMode()
LERNGRUPPE To start the protocoll we need two steps. |
void |
startProtocolByOperator()
LERNGRUPPE Sometimes for testing reasons only a operator have to start the protocol. |
protected void |
tryToStartAgreementHour()
LERNGRUPPE Watch at the clock and start agreement at the right time. |
protected void |
tryToStartAgreementMinute()
LERNGRUPPE Watch at the clock and start agreement at the right time. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected IAgreementHandler m_agreementHandler
protected boolean m_activeAgreementStarted
private boolean doNotHandleAnything
private boolean m_mustBeRestartedForSecurityReason
protected IAgreementLog m_log
private boolean m_beInPassiveMode
| Constructor Detail |
|---|
public AbstractEMCAdapter(IAgreementLog a_log)
setIAgreementHandler(IAgreementHandler p_agreementhandler)
and at next startAdapter()-method. We have to do that
explicitly an NOT in the constructor. So we can take care that all
infoservices know about each other befor starting the protocol.
a_log - The logger to use.| Method Detail |
|---|
public void setIAgreementHandler(IAgreementHandler p_agreementhandler)
startAdapter()-method.
p_agreementhandler - public void startAdapter()
tryToStartAgreement()-method within an endless loop.
Take care that
setIAgreementHandler(IAgreementHandler p_agreementhandler)
was called before!!!
protected void tryToStartAgreementMinute()
protected void tryToStartAgreementHour()
public void handleMessage(IAgreementMessage a_msg)
handleMessage in interface IInfoServiceThe - message.
public void notifyAgreement(java.lang.Long a_oldCommonRandomSeed,
java.lang.Long a_newCommonRandomSeed)
notifyAgreement in interface IInfoServicea_newCommonRandomSeed - the agreed-upon random seedprivate void restartAgreement()
startAgreementCommitmentProtocol() after waiting.
public void startListeningMode()
public void startProtocolByOperator()
protected void startAgreementCommitmentProtocol()
private void reset()
protected abstract void buildCascades(long l)
l - A long value which represents the common random number.protected abstract void startListening()
protected abstract void prepareStart()
throws java.lang.NullPointerException
startAgreementCommitmentProtocol()
befor the call will be delegated.
java.lang.NullPointerException
public abstract void sendMessageTo(java.lang.String a_id,
IAgreementMessage a_message)
sendMessageTo in interface IInfoServicea_id - The ID of the InfoServicea_echoMessage - The messagepublic abstract void multicastMessage(IAgreementMessage a_message)
multicastMessage in interface IInfoServicea_message - public abstract java.lang.String getIdentifier()
IInfoService
getIdentifier in interface IInfoServiceIInfoServicepublic abstract int getNumberOfAllInfoservices()
getNumberOfAllInfoservices in interface IInfoServicepublic void setLog(IAgreementLog a_log)
a_log - A logger.public IAgreementLog getLog()
protected void debug(java.lang.String a_msg)
a_msg - A Message.protected void info(java.lang.String a_msg)
a_msg - A Message.protected void error(java.lang.String a_msg)
a_msg - A Message.protected void fatal(java.lang.String a_msg)
a_msg - A Message.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||