Go to the documentation of this file.00001
00003
00004 #include "EventFilter/StorageManager/interface/CommandQueue.h"
00005 #include "EventFilter/StorageManager/interface/DiskWriterResources.h"
00006 #include "EventFilter/StorageManager/interface/DQMEventProcessorResources.h"
00007 #include "EventFilter/StorageManager/interface/SharedResources.h"
00008 #include "EventFilter/StorageManager/interface/StateMachine.h"
00009 #include "EventFilter/StorageManager/interface/TransitionRecord.h"
00010
00011
00012 #include <iostream>
00013 #include <unistd.h>
00014
00015 using namespace std;
00016 using namespace stor;
00017
00018 Halting::Halting( my_context c ): my_base(c)
00019 {
00020 safeEntryAction();
00021 }
00022
00023 void Halting::do_entryActionWork()
00024 {
00025
00026 TransitionRecord tr( stateName(), true );
00027 outermost_context().updateHistory( tr );
00028
00029 SharedResourcesPtr sharedResources =
00030 outermost_context().getSharedResources();
00031
00032
00033
00034 sharedResources->diskWriterResources_->requestStreamDestruction();
00035
00036
00037
00038 sharedResources->dqmEventProcessorResources_->requestStoreDestruction();
00039 }
00040
00041 Halting::~Halting()
00042 {
00043 safeExitAction();
00044 }
00045
00046 void Halting::do_exitActionWork()
00047 {
00048 TransitionRecord tr( stateName(), false );
00049 outermost_context().updateHistory( tr );
00050 }
00051
00052 string Halting::do_stateName() const
00053 {
00054 return std::string( "Halting" );
00055 }
00056
00057 void Halting::do_moveToFailedState( xcept::Exception& exception ) const
00058 {
00059 outermost_context().getSharedResources()->moveToFailedState( exception );
00060 }
00061
00062 void Halting::logStopDoneRequest( const StopDone& request )
00063 {
00064 outermost_context().unconsumed_event( request );
00065 }
00066
00067 void
00068 Halting::do_noFragmentToProcess() const
00069 {
00070 if ( destructionIsDone() )
00071 {
00072 SharedResourcesPtr sharedResources =
00073 outermost_context().getSharedResources();
00074 EventPtr_t stMachEvent( new HaltDone() );
00075 sharedResources->commandQueue_->enqWait( stMachEvent );
00076 }
00077 }
00078
00079 bool
00080 Halting::destructionIsDone() const
00081 {
00082 SharedResourcesPtr sharedResources =
00083 outermost_context().getSharedResources();
00084
00085
00086 if ( sharedResources->diskWriterResources_->streamChangeOngoing() ) return false;
00087
00088 if ( sharedResources->dqmEventProcessorResources_->requestsOngoing() ) return false;
00089
00090 return true;
00091 }
00092
00093