CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Enabling.cc
Go to the documentation of this file.
1 
8 
9 #include <vector>
10 
11 using std::string;
12 using std::vector;
13 using namespace evf::rb_statemachine;
14 
15 // entry action, state notification, state action
16 //______________________________________________________________________________
18 }
19 
21  SharedResourcesPtr_t res = outermost_context().getSharedResources();
22  LOG4CPLUS_INFO(res->log_, "--> ResourceBroker: NEW STATE: " << stateName());
23  outermost_context().setExternallyVisibleState(stateName());
24  outermost_context().setInternalStateName(stateName());
25  // RCMS notification no longer required here
26  // this is done in FUResourceBroker in SOAP reply
27  //outermost_context().rcmsStateChangeNotify();
28 }
29 
31  SharedResourcesPtr_t res = outermost_context().getSharedResources();
32  IPCMethod* resourceStructure = res->resourceStructure_;
33 
34  try {
35  LOG4CPLUS_INFO(res->log_, "Start enabling ...");
36 
37  // set current run number and reset GUI counters
38  // UPDATED
39  res->reset();
40  resourceStructure->setRunNumber(res->runNumber_);
41  res->lock();
42 
43  /*
44  * UPDATE:
45  * releaseResources
46  * resetPendingAllocates
47  * resetIPC
48  *
49  * after stopping
50  */
51 
52  resourceStructure->resetCounters();
53  res->unlock();
54 
55  LOG4CPLUS_INFO(res->log_, "Starting monitoring / watching workloops.");
56  // starting monitoring workloop
57  res->startMonitoringWorkLoop();
58 
59  // Watching Workloop is used only for Shared Memory IPC
60  if (!res->useMessageQueueIPC_)
61  res->startWatchingWorkLoop();
62 
63  // starting main workloops
64  // 1. Discard
65  res->startDiscardWorkLoop();
66  // 2. Send Data
67  res->startSendDataWorkLoop();
68  // 3. Send DQM
69  res->startSendDqmWorkLoop();
70 
71  resourceStructure->sendAllocate();
72 
73  res->nbTimeoutsWithEvent_ = 0;
74  res->nbTimeoutsWithoutEvent_ = 0;
75  res->dataErrorFlag_ = 0;
76 
77  // make sure I2O discards are allowed
78  // (re-enable discards after stop)
79  res->allowI2ODiscards_ = true;
80 
81  LOG4CPLUS_INFO(res->log_, "Finished enabling!");
82  EventPtr enableDone(new EnableDone());
83  res->commands_.enqEvent(enableDone);
84 
85  } catch (xcept::Exception &e) {
87  }
88 }
89 
90 // construction / destruction
91 //______________________________________________________________________________
92 Enabling::Enabling(my_context c) :
93  my_base(c) {
95 }
96 
99 }
100 
101 // exit action, state name, move to failed state
102 //______________________________________________________________________________
104 }
105 
106 string Enabling::do_stateName() const {
107  return string("Enabling");
108 }
109 
111  SharedResourcesPtr_t res = outermost_context().getSharedResources();
112  res->reasonForFailed_ = exception.what();
113  LOG4CPLUS_FATAL(res->log_,
114  "Moving to FAILED state! Reason: " << exception.what());
115  EventPtr fail(new Fail());
116  res->commands_.enqEvent(fail);
117 }
virtual void do_entryActionWork()
Definition: Enabling.cc:17
void sendAllocate()
Definition: IPCMethod.cc:111
boost::shared_ptr< SharedResources > SharedResourcesPtr_t
virtual void resetCounters()=0
reject
Definition: HLTenums.h:23
virtual void do_moveToFailedState(xcept::Exception &exception) const
Definition: Enabling.cc:110
boost::shared_ptr< boost::statechart::event_base > EventPtr
Definition: CommandQueue.h:23
virtual void do_stateAction() const
Definition: Enabling.cc:30
void setRunNumber(UInt_t runNumber)
Definition: IPCMethod.h:61
void moveToFailedState(xcept::Exception &exception) const
Definition: BaseState.cc:35
virtual std::string do_stateName() const
Definition: Enabling.cc:106
std::string stateName() const
Definition: BaseState.cc:31
virtual void do_exitActionWork()
Definition: Enabling.cc:103
virtual void do_stateNotify()
Definition: Enabling.cc:20