Go to the documentation of this file.00001
00003
00004 #include "EventFilter/StorageManager/interface/AlarmHandler.h"
00005 #include "EventFilter/StorageManager/interface/Configuration.h"
00006 #include "EventFilter/StorageManager/interface/ErrorStreamConfigurationInfo.h"
00007 #include "EventFilter/StorageManager/interface/EventStreamConfigurationInfo.h"
00008 #include "EventFilter/StorageManager/interface/Exception.h"
00009 #include "EventFilter/StorageManager/interface/DiscardManager.h"
00010 #include "EventFilter/StorageManager/interface/SharedResources.h"
00011 #include "EventFilter/StorageManager/interface/StateMachine.h"
00012 #include "EventFilter/StorageManager/interface/StatisticsReporter.h"
00013 #include "EventFilter/StorageManager/interface/TransitionRecord.h"
00014
00015 #include "xcept/tools.h"
00016
00017 #include <iostream>
00018
00019 using namespace std;
00020 using namespace stor;
00021
00022 Ready::Ready( my_context c ): my_base(c)
00023 {
00024 safeEntryAction();
00025 }
00026
00027 void Ready::do_entryActionWork()
00028 {
00029 TransitionRecord tr( stateName(), true );
00030 outermost_context().updateHistory( tr );
00031
00032 SharedResourcesPtr sharedResources =
00033 outermost_context().getSharedResources();
00034
00035
00036 std::string errorMsg = "Failed to update configuration parameters in Ready state";
00037 try
00038 {
00039 sharedResources->configuration_->updateAllParams();
00040 }
00041 catch(xcept::Exception &e)
00042 {
00043 XCEPT_DECLARE_NESTED(stor::exception::Configuration,
00044 sentinelException, errorMsg, e);
00045 sharedResources->alarmHandler_->moveToFailedState( sentinelException );
00046 return;
00047 }
00048 catch( std::exception &e )
00049 {
00050 errorMsg.append(": ");
00051 errorMsg.append( e.what() );
00052
00053 XCEPT_DECLARE(stor::exception::Configuration,
00054 sentinelException, errorMsg);
00055 sharedResources->alarmHandler_->moveToFailedState( sentinelException );
00056 return;
00057 }
00058 catch(...)
00059 {
00060 errorMsg.append(": unknown exception");
00061
00062 XCEPT_DECLARE(stor::exception::Configuration,
00063 sentinelException, errorMsg);
00064 sharedResources->alarmHandler_->moveToFailedState( sentinelException );
00065 return;
00066 }
00067
00068
00069 QueueConfigurationParams queueParams =
00070 sharedResources->configuration_->getQueueConfigurationParams();
00071 sharedResources->commandQueue_->
00072 setCapacity(queueParams.commandQueueSize_);
00073 sharedResources->fragmentQueue_->
00074 setCapacity(queueParams.fragmentQueueSize_);
00075 sharedResources->fragmentQueue_->
00076 setMemory(queueParams.fragmentQueueMemoryLimitMB_ * 1024*1024);
00077 sharedResources->registrationQueue_->
00078 setCapacity(queueParams.registrationQueueSize_);
00079 sharedResources->streamQueue_->
00080 setCapacity(queueParams.streamQueueSize_);
00081 sharedResources->streamQueue_->
00082 setMemory(queueParams.streamQueueMemoryLimitMB_ * 1024*1024);
00083 sharedResources->dqmEventQueue_->
00084 setCapacity(queueParams.dqmEventQueueSize_);
00085 sharedResources->dqmEventQueue_->
00086 setMemory(queueParams.dqmEventQueueMemoryLimitMB_ * 1024*1024);
00087
00088
00089
00090 DiskWritingParams dwParams =
00091 sharedResources->configuration_->getDiskWritingParams();
00092 EvtStrConfigListPtr evtCfgList(new EvtStrConfigList);
00093 ErrStrConfigListPtr errCfgList(new ErrStrConfigList);
00094
00095 parseStreamConfiguration(dwParams.streamConfiguration_, evtCfgList,
00096 errCfgList);
00097 sharedResources->configuration_->setCurrentEventStreamConfig(evtCfgList);
00098 sharedResources->configuration_->setCurrentErrorStreamConfig(errCfgList);
00099
00100
00101 sharedResources->alarmHandler_->clearAllAlarms();
00102
00103
00104 ResourceMonitorCollection& rmc =
00105 sharedResources->statisticsReporter_->getResourceMonitorCollection();
00106 AlarmParams ap =
00107 sharedResources->configuration_->getAlarmParams();
00108 ResourceMonitorParams rmp =
00109 sharedResources->configuration_->getResourceMonitorParams();
00110 rmc.configureAlarms(ap);
00111 rmc.configureResources(rmp);
00112 rmc.configureDisks(dwParams);
00113
00114
00115 RunMonitorCollection& run_mc =
00116 sharedResources->statisticsReporter_->getRunMonitorCollection();
00117 run_mc.configureAlarms(ap);
00118
00119
00120 sharedResources->discardManager_->configure();
00121 }
00122
00123 Ready::~Ready()
00124 {
00125 safeExitAction();
00126 }
00127
00128 void Ready::do_exitActionWork()
00129 {
00130 TransitionRecord tr( stateName(), false );
00131 outermost_context().updateHistory( tr );
00132 }
00133
00134 string Ready::do_stateName() const
00135 {
00136 return std::string( "Ready" );
00137 }
00138
00139 void Ready::do_moveToFailedState( xcept::Exception& exception ) const
00140 {
00141 outermost_context().getSharedResources()->alarmHandler_->moveToFailedState( exception );
00142 }
00143
00144