CMS 3D CMS Logo

Public Member Functions | Public Attributes

stor::SharedResources Struct Reference

#include <SharedResources.h>

List of all members.

Public Member Functions

void localDebug (const std::string &message) const
void moveToFailedState (xcept::Exception &)

Public Attributes

CommandQueuePtr commandQueue_
boost::shared_ptr< Configurationconfiguration_
boost::shared_ptr< DiscardManagerdiscardManager_
boost::shared_ptr
< DiskWriterResources
diskWriterResources_
boost::shared_ptr
< DQMEventProcessorResources
dqmEventProcessorResources_
DQMEventQueuePtr dqmEventQueue_
DQMEventQueueCollectionPtr dqmEventQueueCollection_
EventQueueCollectionPtr eventQueueCollection_
FragmentQueuePtr fragmentQueue_
boost::shared_ptr
< InitMsgCollection
initMsgCollection_
boost::shared_ptr
< RegistrationCollection
registrationCollection_
RegistrationQueuePtr registrationQueue_
boost::shared_ptr
< StatisticsReporter
statisticsReporter_
StreamQueuePtr streamQueue_

Detailed Description

Container for shared resources.

Author:
mommsen
Revision:
1.7
Date:
2011/03/07 15:31:32

Definition at line 40 of file SharedResources.h.


Member Function Documentation

void stor::SharedResources::localDebug ( const std::string &  message) const

Write message to a file in /tmp (last resort when everything else fails)

Definition at line 67 of file SharedResources.cc.

References configuration_, f, alignmentValidation::fname, and dbtoconf::out.

Referenced by moveToFailedState().

  {
    std::ostringstream fname_oss;
    fname_oss << "/tmp/storage_manager_debug_" << 
      configuration_->getDiskWritingParams().smInstanceString_ <<
      "_" << getpid();
    const std::string fname = fname_oss.str();
    std::ofstream f( fname.c_str(), std::ios_base::ate | std::ios_base::out | std::ios_base::app );
    if( f.is_open() )
    {
      try
      {
        f << message << std::endl;
        f.close();
      }
      catch(...)
      {}
    }
  }
void stor::SharedResources::moveToFailedState ( xcept::Exception exception)

Add a Failed state-machine event to the command queue

Definition at line 28 of file SharedResources.cc.

References commandQueue_, ExpressReco_HICollisions_FallBack::e, exception, Exception, Fail, stor::AlarmHandler::FATAL, localDebug(), seconds(), and statisticsReporter_.

  {
    std::string errorMsg = "Failed to process FAIL exception: "
      + xcept::stdformat_exception_history(exception) + " due to ";

    try
    {
      statisticsReporter_->alarmHandler()->notifySentinel(AlarmHandler::FATAL, exception);
      statisticsReporter_->getStateMachineMonitorCollection().setStatusMessage( 
        xcept::stdformat_exception_history(exception)
      );
      EventPtr_t stMachEvent( new Fail() );
      // wait maximum 5 seconds until enqueuing succeeds
      if ( ! commandQueue_->enqTimedWait( stMachEvent, boost::posix_time::seconds(5) ) )
      {
        XCEPT_DECLARE_NESTED( stor::exception::StateTransition,
          sentinelException, "Failed to enqueue FAIL event", exception );
        statisticsReporter_->alarmHandler()->
          notifySentinel(AlarmHandler::FATAL, sentinelException);
      }
    }
    catch(xcept::Exception &e)
    {
      errorMsg += xcept::stdformat_exception_history(e);
      localDebug( errorMsg );
    }
    catch(std::exception &e)
    {
      errorMsg += e.what();
      localDebug( errorMsg );
    }
    catch( ... )
    {
      errorMsg += "an unknown exception.";
      localDebug( errorMsg );
    }
  }

Member Data Documentation

Definition at line 44 of file SharedResources.h.

Referenced by moveToFailedState().

Definition at line 53 of file SharedResources.h.

Referenced by localDebug().

Definition at line 54 of file SharedResources.h.

Definition at line 55 of file SharedResources.h.

Definition at line 56 of file SharedResources.h.

Definition at line 45 of file SharedResources.h.

Definition at line 50 of file SharedResources.h.

Definition at line 49 of file SharedResources.h.

Definition at line 46 of file SharedResources.h.

Definition at line 57 of file SharedResources.h.

Definition at line 59 of file SharedResources.h.

Definition at line 48 of file SharedResources.h.

Definition at line 58 of file SharedResources.h.

Referenced by moveToFailedState().

Definition at line 47 of file SharedResources.h.