1
0
Fork 0

proper shutdown procedure in agent

This commit is contained in:
Kaveh Vahedipour 2017-01-26 10:20:38 +01:00
parent 618955369a
commit 5bccc799a9
1 changed files with 6 additions and 12 deletions

View File

@ -926,14 +926,14 @@ void Agent::detectActiveAgentFailures() {
void Agent::beginShutdown() {
Thread::beginShutdown();
// Stop constituent and key value stores
_constituent.beginShutdown();
// Stop supervision
if (_config.supervision()) {
_supervision.beginShutdown();
}
// Stop constituent and key value stores
_constituent.beginShutdown();
// Stop inception process
if (_inception != nullptr) {
_inception->beginShutdown();
@ -943,6 +943,7 @@ void Agent::beginShutdown() {
_spearhead.beginShutdown();
_readDB.beginShutdown();
int counter = 0;
if (_inception != nullptr) {
int counter = 0;
while (_inception->isRunning()) {
@ -954,7 +955,7 @@ void Agent::beginShutdown() {
}
}
int counter = 0;
counter = 0;
while (_spearhead.isRunning() || _readDB.isRunning()) {
usleep(100000);
// emit warning after 5 seconds
@ -963,6 +964,7 @@ void Agent::beginShutdown() {
}
}
counter = 0;
while (_constituent.isRunning()) {
usleep(100000);
// emit warning after 5 seconds
@ -971,14 +973,6 @@ void Agent::beginShutdown() {
}
}
/* while (_supervision.isRunning()) {
usleep(100000);
// emit warning after 5 seconds
if (++counter == 10 * 5) {
LOG_TOPIC(WARN, Logger::AGENCY) << "waiting for supervision thread to finish";
}
}*/
// Wake up all waiting rest handlers
{
CONDITION_LOCKER(guardW, _waitForCV);