Skip to content
Snippets Groups Projects
Commit c9947290 authored by Ruud Overeem's avatar Ruud Overeem
Browse files

BugID: 1000

Added extra timer that depends on the integration-time of the observation that
will force a kill of the underlying software.
parent cc9af1e5
No related branches found
No related tags found
No related merge requests found
...@@ -70,7 +70,8 @@ ObservationControl::ObservationControl(const string& cntlrName) : ...@@ -70,7 +70,8 @@ ObservationControl::ObservationControl(const string& cntlrName) :
itsStopTimer (0), itsStopTimer (0),
itsForcedQuitTimer (0), itsForcedQuitTimer (0),
itsHeartBeatTimer (0), itsHeartBeatTimer (0),
itsHeartBeatItv (0) itsHeartBeatItv (0),
itsForcedQuitDelay (0)
{ {
LOG_TRACE_OBJ_STR (cntlrName << " construction"); LOG_TRACE_OBJ_STR (cntlrName << " construction");
...@@ -91,6 +92,12 @@ ObservationControl::ObservationControl(const string& cntlrName) : ...@@ -91,6 +92,12 @@ ObservationControl::ObservationControl(const string& cntlrName) :
itsInstanceNr = globalParameterSet()->getUint32("_treeID"); // !!! itsInstanceNr = globalParameterSet()->getUint32("_treeID"); // !!!
itsHeartBeatItv = globalParameterSet()->getUint32("heartbeatInterval"); itsHeartBeatItv = globalParameterSet()->getUint32("heartbeatInterval");
// The time I have to wait for the forced quit depends on the integration time of OLAP
string OLAPpos = globalParameterSet()->locateModule("OLAP");
LOG_DEBUG(OLAPpos+"OLAP.IONProc.integrationSteps");
itsForcedQuitDelay = 15 + globalParameterSet()->getUint32(OLAPpos+"OLAP.IONProc.integrationSteps",0);
LOG_DEBUG_STR ("Timer for forcing quit is set to " << itsForcedQuitDelay);
// Inform Logging manager who we are // Inform Logging manager who we are
// TODO read this from the PARSET file! // TODO read this from the PARSET file!
uint32 treeID(globalParameterSet()->getUint32("_treeID")); uint32 treeID(globalParameterSet()->getUint32("_treeID"));
...@@ -431,7 +438,7 @@ GCFEvent::TResult ObservationControl::active_state(GCFEvent& event, GCFPortInter ...@@ -431,7 +438,7 @@ GCFEvent::TResult ObservationControl::active_state(GCFEvent& event, GCFPortInter
itsBusyControllers = itsChildControl->countChilds(0, CNTLRTYPE_NO_TYPE); itsBusyControllers = itsChildControl->countChilds(0, CNTLRTYPE_NO_TYPE);
// reschedule forced-quit timer for safety. // reschedule forced-quit timer for safety.
itsTimerPort->cancelTimer(itsForcedQuitTimer); itsTimerPort->cancelTimer(itsForcedQuitTimer);
itsForcedQuitTimer = itsTimerPort->setTimer(5.0); itsForcedQuitTimer = itsTimerPort->setTimer(1.0 * itsForcedQuitDelay);
} }
else if (timerEvent.id == itsForcedQuitTimer) { else if (timerEvent.id == itsForcedQuitTimer) {
LOG_WARN("QUITING BEFORE ALL CHILDREN DIED."); LOG_WARN("QUITING BEFORE ALL CHILDREN DIED.");
...@@ -659,8 +666,8 @@ void ObservationControl::setObservationTimers() ...@@ -659,8 +666,8 @@ void ObservationControl::setObservationTimers()
if (itsState < CTState::RELEASE) { // not yet shutting down? if (itsState < CTState::RELEASE) { // not yet shutting down?
if (sec2stop > 0) { if (sec2stop > 0) {
itsStopTimer = itsTimerPort->setTimer(1.0 * sec2stop); itsStopTimer = itsTimerPort->setTimer(1.0 * sec2stop);
// make sure we go down 5 seconds after quit was requested. // make sure we go down 30 seconds after quit was requested.
itsForcedQuitTimer = itsTimerPort->setTimer(sec2stop + 5.0); itsForcedQuitTimer = itsTimerPort->setTimer(sec2stop + (1.0 * itsForcedQuitDelay));
LOG_DEBUG_STR ("Observation stops over " << sec2stop << " seconds"); LOG_DEBUG_STR ("Observation stops over " << sec2stop << " seconds");
} }
else { else {
...@@ -785,7 +792,7 @@ void ObservationControl::_databaseEventHandler(GCFEvent& event) ...@@ -785,7 +792,7 @@ void ObservationControl::_databaseEventHandler(GCFEvent& event)
if (strstr(dpEvent.DPname.c_str(), PN_OC_CLAIM_PERIOD) != 0) { if (strstr(dpEvent.DPname.c_str(), PN_OC_CLAIM_PERIOD) != 0) {
uint32 newVal = ((GCFPVInteger*) (dpEvent.value._pValue))->getValue(); uint32 newVal = ((GCFPVInteger*) (dpEvent.value._pValue))->getValue();
LOG_INFO_STR ("Changing ClaimPeriod from " << itsClaimPeriod << " to " << newVal); LOG_INFO_STR ("Changing ClaimPeriod from " << itsClaimPeriod << " to " << newVal);
itsClaimPeriod = newVal; itsClaimPeriod = newVal;
} }
// Change of prepare_period? // Change of prepare_period?
else if (strstr(dpEvent.DPname.c_str(), PN_OC_PREPARE_PERIOD) != 0) { else if (strstr(dpEvent.DPname.c_str(), PN_OC_PREPARE_PERIOD) != 0) {
...@@ -815,9 +822,9 @@ void ObservationControl::_databaseEventHandler(GCFEvent& event) ...@@ -815,9 +822,9 @@ void ObservationControl::_databaseEventHandler(GCFEvent& event)
itsStopTime = newTime; itsStopTime = newTime;
} }
setObservationTimers(); setObservationTimers();
LOG_DEBUG("Sending all childs a RESCHEDULE event"); LOG_DEBUG("NOT YET Sending all childs a RESCHEDULE event");
itsChildControl->rescheduleChilds(to_time_t(itsStartTime), // itsChildControl->rescheduleChilds(to_time_t(itsStartTime),
to_time_t(itsStopTime), ""); // to_time_t(itsStopTime), "");
} }
} }
break; break;
......
...@@ -135,6 +135,7 @@ private: ...@@ -135,6 +135,7 @@ private:
string itsTreePrefix; string itsTreePrefix;
uint32 itsInstanceNr; uint32 itsInstanceNr;
uint32 itsHeartBeatItv; uint32 itsHeartBeatItv;
uint32 itsForcedQuitDelay;
uint32 itsClaimPeriod; uint32 itsClaimPeriod;
uint32 itsPreparePeriod; uint32 itsPreparePeriod;
ptime itsStartTime; ptime itsStartTime;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment