CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/EventFilter/ResourceBroker/src/Halted.cc

Go to the documentation of this file.
00001 
00006 #include "EventFilter/ResourceBroker/interface/SharedResources.h"
00007 #include "EventFilter/ResourceBroker/interface/RBStateMachine.h"
00008 
00009 using std::string;
00010 using namespace evf::rb_statemachine;
00011 
00012 // entry action, state notification, state action
00013 //______________________________________________________________________________
00014 void Halted::do_entryActionWork() {
00015         if (outermost_context().firstTimeInHalted())
00016                 // set states, not RCMS notification
00017                 //do_stateNotify();
00018                 outermost_context().setExternallyVisibleState(do_stateName());
00019         outermost_context().setInternalStateName(do_stateName());
00020 }
00021 
00022 void Halted::do_stateNotify() {
00023         SharedResourcesPtr_t res = outermost_context().getSharedResources();
00024         LOG4CPLUS_INFO(res->log_, "--> ResourceBroker: NEW STATE: " << stateName());
00025         outermost_context().setExternallyVisibleState(stateName());
00026         outermost_context().setInternalStateName(stateName());
00027         // notify RCMS of the new state
00028         outermost_context().rcmsStateChangeNotify();
00029 }
00030 
00031 // construction / destruction
00032 //______________________________________________________________________________
00033 Halted::Halted(my_context c) :
00034         my_base(c) {
00035         safeEntryAction();
00036 }
00037 
00038 Halted::~Halted() {
00039         safeExitAction();
00040 }
00041 
00042 // exit action, state name, move to failed state
00043 //______________________________________________________________________________
00044 void Halted::do_exitActionWork() {
00045         outermost_context().setFirstTimeInHaltedFalse();
00046 }
00047 
00048 string Halted::do_stateName() const {
00049         return string("Halted");
00050 }
00051 
00052 void Halted::do_moveToFailedState(xcept::Exception& exception) const {
00053         SharedResourcesPtr_t res = outermost_context().getSharedResources();
00054         res->reasonForFailed_ = exception.what();
00055         LOG4CPLUS_FATAL(res->log_,
00056                         "Moving to FAILED state! Reason: " << exception.what());
00057         EventPtr fail(new Fail());
00058         res->commands_.enqEvent(fail);
00059 }