void Testing::evRestartProcess( SipxProcess& impl ) const { Os::Logger::instance().log(FAC_SUPERVISOR, PRI_DEBUG,"'%s': aborting configtest in order to restart", impl.name()); ChangeState( impl, impl.pStoppingConfigtestToRestart ); impl.killConfigTest(); }
void Testing::evShutdown( SipxProcess& impl ) const { Os::Logger::instance().log(FAC_SUPERVISOR, PRI_DEBUG,"'%s': aborting configtest in order to shutdown", impl.name()); ChangeState( impl, impl.pShuttingDown ); impl.killConfigTest(); }
void SipxProcessFsm::evStopProcess( SipxProcess& impl ) const { Os::Logger::instance().log(FAC_SUPERVISOR,PRI_INFO,"'%s': Received event evStopProcess while in state '%s'", impl.name(), impl.GetCurrentState()->name() ); ChangeState( impl, impl.pStopping); }
void Testing::DoEntryAction( SipxProcess& impl ) const { impl.checkThreadId(); impl.clearStatusMessages(); impl.startConfigTest(); }
void SipxProcessFsm::evRestartProcess( SipxProcess& impl ) const { OsSysLog::add(FAC_SUPERVISOR,PRI_INFO,"'%s': Received event evRestartProcess while in state '%s'", impl.name(), impl.GetCurrentState()->name() ); ChangeState( impl, impl.pConfigurationMismatch ); }
void SipxProcessFsm::evResyncProcess( SipxProcess& impl ) const { Os::Logger::instance().log(FAC_SUPERVISOR,PRI_INFO,"'%s': Received event evResyncProcess while in state '%s'", impl.name(), impl.GetCurrentState()->name() ); ChangeState( impl, impl.pConfigurationMismatch ); }
void Stopping::DoEntryAction( SipxProcess& impl ) const { impl.checkThreadId(); impl.notifyShutdown(); impl.startStopTimer(); impl.stopProcess(); }
void SipxProcessFsm::evProcessStopped( SipxProcess& impl ) const { Os::Logger::instance().log(FAC_SUPERVISOR,PRI_WARNING,"'%s': Received unexpected event evProcessStopped while in state '%s'", impl.name(), impl.GetCurrentState()->name() ); ChangeState( impl, impl.pFailed); }
void SipxProcessFsm::evShutdown( SipxProcess& impl ) const { Os::Logger::instance().log(FAC_SUPERVISOR,PRI_DEBUG,"'%s': Received event evShutdown while in state '%s'", impl.name(), impl.GetCurrentState()->name() ); ChangeState( impl, impl.pShutDown); }
void ConfigurationMismatch::evConfigurationVersionUpdated( SipxProcess& impl ) const { impl.clearStatusMessages(); if ( impl.configurationVersionMatches() ) { ChangeState( impl, impl.pResourceRequired ); } }
void Disabled::DoEntryAction( SipxProcess& impl ) const { impl.checkThreadId(); impl.clearStatusMessages(); if (impl.isEnabled()) { impl.enable(); } }
void Running::evProcessStopped( SipxProcess& impl ) const { impl.checkThreadId(); if (impl.isEnabled()) { impl.processFailed(); ChangeState( impl, impl.pFailed); } else { ChangeState( impl, impl.pDisabled); } }
void Starting::evProcessStarted( SipxProcess& impl ) const { if (impl.hadProcessFailed()) { Alarm::raiseAlarm("PROCESS_RESTARTED", impl.data()); } else if (impl.hadProcessBlocked()) { Alarm::raiseAlarm("PROCESS_STARTED", impl.data()); impl.clearProcessBlocked(); } ChangeState( impl, impl.pRunning ); }
void ResourceRequired::DoEntryAction( SipxProcess& impl ) const { impl.checkThreadId(); impl.clearStatusMessages(); if ( impl.resourcesAreReady() ) { ChangeState( impl, impl.pTesting ); } else { impl.startDelayReportingTimer(); } }
void ConfigurationMismatch::DoEntryAction( SipxProcess& impl ) const { impl.checkThreadId(); impl.clearStatusMessages(); if ( impl.configurationVersionMatches() ) { ChangeState( impl, impl.pResourceRequired ); } else { impl.startDelayReportingTimer(); } }
// Whether or not the SipxProcessResource is ready for use by a SipxProcess. bool SipxProcessResource::isReadyToStart(UtlString& missingResource) { SipxProcess* myProcess = getProcess(); bool bReady = (myProcess && myProcess->isRunning()); if ( !bReady ) { missingResource = ""; appendDescription(missingResource); OsSysLog::add(FAC_SUPERVISOR, PRI_WARNING, "SipxProcessResource::isReadyToStart returns false; %s is not running ", data()); } return bReady; }
void Disabled::evRestartProcess( SipxProcess& impl ) const { if (impl.isEnabled()) { ChangeState( impl, impl.pConfigurationMismatch ); } }
// Fill in a map of process names and states (as UtlStrings) void SipxProcessManager::getProcessStateAll(UtlHashMap& processStates //< key->name, value->state string ) { processStates.destroyAll(); SipxProcess* process; // the lock is not required with the Iterator UtlHashBagIterator processes(mProcesses); while ((process = dynamic_cast<SipxProcess*>(processes()))) { if ( 0 != process->compareTo(SUPERVISOR_PROCESS_NAME) ) { processStates.insertKeyAndValue(new UtlString(process->data()), new UtlString(process->GetCurrentState()->name()) ); } } }
// We need both the actual process, and the script which stops it, to finish // before we move on. These events can come in any order. void Stopping::evProcessStopped( SipxProcess& impl ) const { impl.checkThreadId(); if (impl.isCompletelyStopped()) { if (impl.isEnabled()) { ChangeState( impl, impl.pConfigurationMismatch ); } else { ChangeState( impl, impl.pDisabled ); } } else { OsSysLog::add(FAC_SUPERVISOR, PRI_DEBUG,"'%s': process stopped, now wait for stop script", impl.name()); } }
void Stopping::evStopCompleted( SipxProcess& impl ) const { impl.checkThreadId(); if (impl.isCompletelyStopped()) { if (impl.isEnabled()) { ChangeState( impl, impl.pConfigurationMismatch ); } else { ChangeState( impl, impl.pDisabled ); } } else { Os::Logger::instance().log(FAC_SUPERVISOR, PRI_DEBUG,"'%s': stop completed, now wait for process stopped", impl.name()); } }
/// Some change has been made to this resource; notify any SipxProcesses that use it. void SipxResource::modified() { UtlSListIterator processResources(mUsedBy); SipxProcessResource* processResource; while ((processResource = dynamic_cast<SipxProcessResource*>(processResources()))) { SipxProcess* process; if ((process=processResource->getProcess())) { process->configurationChange(*this); } else { /* there is no process for this process resource * - can happen when a definition is invalid, and has already been logged. */ } } }
// We need both the actual process, and the script which stops it, to finish // before we move on. These events can come in any order. void ShuttingDown::evProcessStopped( SipxProcess& impl ) const { if (impl.isCompletelyStopped()) { ChangeState( impl, impl.pShutDown ); } else { OsSysLog::add(FAC_SUPERVISOR, PRI_DEBUG,"'%s': process stopped, now wait for stop script", impl.name()); } }
void ShuttingDown::evStopCompleted( SipxProcess& impl ) const { if (impl.isCompletelyStopped()) { ChangeState( impl, impl.pShutDown ); } else { Os::Logger::instance().log(FAC_SUPERVISOR, PRI_DEBUG,"'%s': stop completed, now wait for process stopped", impl.name()); } }
/// destructor SipxProcessManager::~SipxProcessManager() { OsLock tableMutex(mProcessTableLock); SipxProcess* process; // send shutdowns to all processes before waiting for them to delete UtlHashBagIterator processes(mProcesses); while ((process = dynamic_cast<SipxProcess*>(processes()))) { process->shutdown(); OsTask::delay(100); } Os::Logger::instance().log(FAC_SUPERVISOR, PRI_NOTICE, "SipxProcessManager::~ " "delete %zu SipxProcess objects", mProcesses.entries()); mProcesses.destroyAll(); while (mProcesses.entries() > 0) { OsTask::delay(1000); } };
void SipxProcessFsm::evTimeout( SipxProcess& impl ) const { Os::Logger::instance().log(FAC_SUPERVISOR,PRI_WARNING,"'%s': Received unexpected event evTimeout while in state '%s'", impl.name(), impl.GetCurrentState()->name() ); }
void ShutDown::evStopCompleted( SipxProcess& impl ) const { Os::Logger::instance().log(FAC_SUPERVISOR, PRI_DEBUG,"'%s': evStopCompleted in state '%s', ignored", impl.name(), impl.GetCurrentState()->name()); }
void ShutDown::DoEntryAction( SipxProcess& impl ) const { impl.done(); }
void ShuttingDown::DoEntryAction( SipxProcess& impl ) const { impl.stopProcess(); }
void Running::evConfigurationChanged( SipxProcess& impl ) const { Os::Logger::instance().log(FAC_SUPERVISOR, PRI_NOTICE,"'%s': configuration changed in state '%s', ignored", impl.name(), impl.GetCurrentState()->name()); }
void Running::DoEntryAction( SipxProcess& impl ) const { impl.clearStatusMessages(); impl.notifyProcessRunning(); }