#include <StateMachine.h>
Definition at line 68 of file StateMachine.h.
smproxy::StateMachine::StateMachine | ( | xdaq::Application * | app | ) |
Definition at line 20 of file StateMachine.cc.
References edm::errors::Configuration.
: app_(app), rcmsStateNotifier_ ( app->getApplicationLogger(), app->getApplicationDescriptor(), app->getApplicationContext() ), reasonForFailed_(""), stateName_("Halted") { std::ostringstream oss; oss << app->getApplicationDescriptor()->getClassName() << app->getApplicationDescriptor()->getInstance(); appNameAndInstance_ = oss.str(); xdata::InfoSpace *is = app->getApplicationInfoSpace(); is->fireItemAvailable("rcmsStateListener", rcmsStateNotifier_.getRcmsStateListenerParameter() ); is->fireItemAvailable("foundRcmsStateListener", rcmsStateNotifier_.getFoundRcmsStateListenerParameter() ); rcmsStateNotifier_.findRcmsStateListener(); rcmsStateNotifier_.subscribeToChangesInRcmsStateListener(is); is->fireItemAvailable("stateName", &stateName_); initiate(); configuration_.reset(new Configuration( app->getApplicationInfoSpace(), app->getApplicationDescriptor()->getInstance() )); registrationCollection_.reset( new stor::RegistrationCollection() ); registrationQueue_.reset(new stor::RegistrationQueue( configuration_->getQueueConfigurationParams().registrationQueueSize_ )); initMsgCollection_.reset(new stor::InitMsgCollection()); statisticsReporter_.reset(new StatisticsReporter(app, configuration_->getQueueConfigurationParams())); eventQueueCollection_.reset(new EventQueueCollection( statisticsReporter_->getEventConsumerMonitorCollection())); dqmEventQueueCollection_.reset(new stor::DQMEventQueueCollection( statisticsReporter_->getDQMConsumerMonitorCollection())); dataManager_.reset(new DataManager(this)); }
void smproxy::StateMachine::clearConsumerRegistrations | ( | ) |
Definition at line 169 of file StateMachine.cc.
References dqmEventQueueCollection_, eventQueueCollection_, and registrationCollection_.
{ registrationCollection_->clearRegistrations(); eventQueueCollection_->removeQueues(); dqmEventQueueCollection_->removeQueues(); }
void smproxy::StateMachine::clearInitMsgCollection | ( | ) |
Definition at line 157 of file StateMachine.cc.
References initMsgCollection_.
{ initMsgCollection_->clear(); }
void smproxy::StateMachine::clearQueues | ( | ) |
Definition at line 191 of file StateMachine.cc.
References dqmEventQueueCollection_, eventQueueCollection_, and registrationQueue_.
{ registrationQueue_->clear(); eventQueueCollection_->clearQueues(); dqmEventQueueCollection_->clearQueues(); }
void smproxy::StateMachine::disableConsumerRegistration | ( | ) |
Definition at line 184 of file StateMachine.cc.
References dataManager_, and registrationCollection_.
{ registrationCollection_->disableConsumerRegistration(); dataManager_->stop(); }
void smproxy::StateMachine::enableConsumerRegistration | ( | ) |
Definition at line 177 of file StateMachine.cc.
References configuration_, dataManager_, and registrationCollection_.
{ registrationCollection_->enableConsumerRegistration(); dataManager_->start(configuration_->getDataRetrieverParams()); }
void smproxy::StateMachine::failEvent | ( | const Fail & | evt | ) |
Definition at line 92 of file StateMachine.cc.
References app_, smproxy::Fail::getException(), smproxy::Fail::getReason(), smproxy::Fail::getTraceback(), rcmsStateNotifier_, reasonForFailed_, and stateName_.
{ stateName_ = "Failed"; reasonForFailed_ = evt.getTraceback(); LOG4CPLUS_FATAL(app_->getApplicationLogger(), "Failed: " << evt.getReason() << ". " << reasonForFailed_); rcmsStateNotifier_.stateChanged(stateName_, evt.getReason()); app_->notifyQualified("fatal", evt.getException()); }
xdaq::ApplicationDescriptor* smproxy::StateMachine::getApplicationDescriptor | ( | ) | const [inline] |
Definition at line 109 of file StateMachine.h.
References app_.
{ return app_->getApplicationDescriptor(); }
ConfigurationPtr smproxy::StateMachine::getConfiguration | ( | ) | const [inline] |
Definition at line 93 of file StateMachine.h.
References configuration_.
Referenced by smproxy::DQMArchiver::createRegistration().
{ return configuration_; }
DataManagerPtr smproxy::StateMachine::getDataManager | ( | ) | const [inline] |
stor::DQMEventQueueCollectionPtr smproxy::StateMachine::getDQMEventQueueCollection | ( | ) | const [inline] |
Definition at line 105 of file StateMachine.h.
References dqmEventQueueCollection_.
Referenced by smproxy::DataManager::checkForStaleConsumers().
{ return dqmEventQueueCollection_; }
EventQueueCollectionPtr smproxy::StateMachine::getEventQueueCollection | ( | ) | const [inline] |
Definition at line 103 of file StateMachine.h.
References eventQueueCollection_.
Referenced by smproxy::DataManager::checkForStaleConsumers().
{ return eventQueueCollection_; }
std::string smproxy::StateMachine::getExternallyVisibleStateName | ( | ) | [inline] |
Definition at line 90 of file StateMachine.h.
References stateName_.
{ return stateName_.toString(); }
stor::InitMsgCollectionPtr smproxy::StateMachine::getInitMsgCollection | ( | ) | const [inline] |
Definition at line 101 of file StateMachine.h.
References initMsgCollection_.
{ return initMsgCollection_; }
std::string smproxy::StateMachine::getReasonForFailed | ( | ) | [inline] |
Definition at line 86 of file StateMachine.h.
References reasonForFailed_.
{ return reasonForFailed_; }
stor::RegistrationCollectionPtr smproxy::StateMachine::getRegistrationCollection | ( | ) | const [inline] |
Definition at line 97 of file StateMachine.h.
References registrationCollection_.
Referenced by smproxy::DQMArchiver::createRegistration(), and smproxy::DQMArchiver::doIt().
{ return registrationCollection_; }
stor::RegistrationQueuePtr smproxy::StateMachine::getRegistrationQueue | ( | ) | const [inline] |
Definition at line 99 of file StateMachine.h.
References registrationQueue_.
{ return registrationQueue_; }
std::string smproxy::StateMachine::getStateName | ( | ) | [inline] |
Definition at line 88 of file StateMachine.h.
{ return state_cast<const StateName&>().stateName(); }
StatisticsReporterPtr smproxy::StateMachine::getStatisticsReporter | ( | ) | const [inline] |
Definition at line 107 of file StateMachine.h.
References statisticsReporter_.
{ return statisticsReporter_; }
void smproxy::StateMachine::moveToFailedState | ( | xcept::Exception & | e | ) | [inline] |
Definition at line 79 of file StateMachine.h.
References Fail, and processEvent().
Referenced by smproxy::DataManager::activity(), smproxy::DQMArchiver::activity(), updateConfiguration(), and smproxy::DataManager::watchDog().
{ processEvent( Fail(e) ); }
std::string smproxy::StateMachine::processEvent | ( | const boost::statechart::event_base & | event | ) |
Definition at line 75 of file StateMachine.cc.
References eventMutex_.
Referenced by moveToFailedState().
{ boost::mutex::scoped_lock sl(eventMutex_); process_event(event); return state_cast<const StateName&>().stateName(); }
void smproxy::StateMachine::resetStatistics | ( | ) |
Definition at line 163 of file StateMachine.cc.
References statisticsReporter_.
{ statisticsReporter_->reset(); }
void smproxy::StateMachine::setExternallyVisibleStateName | ( | const std::string & | stateName | ) |
Definition at line 83 of file StateMachine.cc.
References appNameAndInstance_, rcmsStateNotifier_, and stateName_.
{ stateName_ = stateName; rcmsStateNotifier_.stateChanged(stateName, appNameAndInstance_ + " has reached target state " + stateName); }
void smproxy::StateMachine::setQueueSizes | ( | ) |
Definition at line 148 of file StateMachine.cc.
References configuration_, registrationQueue_, and smproxy::QueueConfigurationParams::registrationQueueSize_.
{ QueueConfigurationParams queueParams = configuration_->getQueueConfigurationParams(); registrationQueue_-> setCapacity(queueParams.registrationQueueSize_); }
void smproxy::StateMachine::unconsumed_event | ( | const boost::statechart::event_base & | evt | ) |
Definition at line 106 of file StateMachine.cc.
References app_, AlCaRecoCosmics_cfg::name, and stateName_.
{ LOG4CPLUS_ERROR(app_->getApplicationLogger(), "The " << typeid(evt).name() << " event is not supported from the " << stateName_.toString() << " state!"); }
void smproxy::StateMachine::updateConfiguration | ( | ) |
Definition at line 115 of file StateMachine.cc.
References edm::errors::Configuration, configuration_, ExpressReco_HICollisions_FallBack::e, exception, Exception, and moveToFailedState().
{ std::string errorMsg = "Failed to update configuration parameters"; try { configuration_->updateAllParams(); } catch(xcept::Exception &e) { XCEPT_DECLARE_NESTED(exception::Configuration, sentinelException, errorMsg, e); moveToFailedState(sentinelException); } catch( std::exception &e ) { errorMsg.append(": "); errorMsg.append( e.what() ); XCEPT_DECLARE(exception::Configuration, sentinelException, errorMsg); moveToFailedState(sentinelException); } catch(...) { errorMsg.append(": unknown exception"); XCEPT_DECLARE(exception::Configuration, sentinelException, errorMsg); moveToFailedState(sentinelException); } }
xdaq::Application* smproxy::StateMachine::app_ [private] |
Definition at line 124 of file StateMachine.h.
Referenced by failEvent(), getApplicationDescriptor(), and unconsumed_event().
std::string smproxy::StateMachine::appNameAndInstance_ [private] |
Definition at line 137 of file StateMachine.h.
Referenced by setExternallyVisibleStateName().
Definition at line 126 of file StateMachine.h.
Referenced by enableConsumerRegistration(), getConfiguration(), setQueueSizes(), and updateConfiguration().
Definition at line 127 of file StateMachine.h.
Referenced by disableConsumerRegistration(), enableConsumerRegistration(), and getDataManager().
Definition at line 133 of file StateMachine.h.
Referenced by clearConsumerRegistrations(), clearQueues(), and getDQMEventQueueCollection().
boost::mutex smproxy::StateMachine::eventMutex_ [mutable, private] |
Definition at line 135 of file StateMachine.h.
Referenced by processEvent().
Definition at line 132 of file StateMachine.h.
Referenced by clearConsumerRegistrations(), clearQueues(), and getEventQueueCollection().
Definition at line 130 of file StateMachine.h.
Referenced by clearInitMsgCollection(), and getInitMsgCollection().
xdaq2rc::RcmsStateNotifier smproxy::StateMachine::rcmsStateNotifier_ [private] |
Definition at line 125 of file StateMachine.h.
Referenced by failEvent(), and setExternallyVisibleStateName().
std::string smproxy::StateMachine::reasonForFailed_ [private] |
Definition at line 138 of file StateMachine.h.
Referenced by failEvent(), and getReasonForFailed().
Definition at line 128 of file StateMachine.h.
Referenced by clearConsumerRegistrations(), disableConsumerRegistration(), enableConsumerRegistration(), and getRegistrationCollection().
Definition at line 129 of file StateMachine.h.
Referenced by clearQueues(), getRegistrationQueue(), and setQueueSizes().
xdata::String smproxy::StateMachine::stateName_ [private] |
Definition at line 139 of file StateMachine.h.
Referenced by failEvent(), getExternallyVisibleStateName(), setExternallyVisibleStateName(), and unconsumed_event().
Definition at line 131 of file StateMachine.h.
Referenced by getStatisticsReporter(), and resetStatistics().