CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
stor::DiskWriterResources Class Reference

#include <DiskWriterResources.h>

Public Member Functions

 DiskWriterResources ()
 
bool isBusy ()
 
void requestStreamConfiguration (EvtStrConfigListPtr const, ErrStrConfigListPtr const, DiskWritingParams const &, unsigned int const &runNumber, boost::posix_time::time_duration const &timeoutValue)
 
void requestStreamDestruction ()
 
void setBusy (bool isBusyFlag)
 
void streamChangeDone ()
 
virtual bool streamChangeOngoing ()
 
bool streamChangeRequested (bool &doConfig, EvtStrConfigListPtr &, ErrStrConfigListPtr &, DiskWritingParams &dwParams, unsigned int &runNumber, boost::posix_time::time_duration &timeoutValue)
 
virtual void waitForStreamChange ()
 
virtual ~DiskWriterResources ()
 

Private Attributes

bool configurationIsNeeded_
 
bool diskWriterIsBusy_
 
bool fileClosingTestIsNeeded_
 
DiskWritingParams requestedDiskWritingParams_
 
ErrStrConfigListPtr requestedErrorStreamConfig_
 
EvtStrConfigListPtr requestedEventStreamConfig_
 
unsigned int requestedRunNumber_
 
boost::posix_time::time_duration requestedTimeout_
 
boost::condition streamChangeCondition_
 
bool streamChangeInProgress_
 
bool streamChangeIsNeeded_
 
boost::mutex streamChangeMutex_
 

Detailed Description

Container class for resources that are needed by the DiskWriter and need to be accessed from multiple threads.

Author:
mommsen
Revision:
1.9
Date:
2011/03/07 15:31:31

Definition at line 32 of file DiskWriterResources.h.

Constructor & Destructor Documentation

stor::DiskWriterResources::DiskWriterResources ( )
virtual stor::DiskWriterResources::~DiskWriterResources ( )
inlinevirtual

Destructor.

Definition at line 44 of file DiskWriterResources.h.

44 {}

Member Function Documentation

bool stor::DiskWriterResources::isBusy ( )

Tests if the DiskWriter is currently busy..

Definition at line 107 of file DiskWriterResources.cc.

References diskWriterIsBusy_.

Referenced by Vispa.Plugins.EventBrowser.EventBrowserTabController.EventBrowserTabController::navigate().

108  {
109  //boost::mutex::scoped_lock sl(generalMutex_);
110  return diskWriterIsBusy_;
111  }
void stor::DiskWriterResources::requestStreamConfiguration ( EvtStrConfigListPtr const  evtStrConfig,
ErrStrConfigListPtr const  errStrConfig,
DiskWritingParams const &  dwParams,
unsigned int const &  runNumber,
boost::posix_time::time_duration const &  timeoutValue 
)

Requests that the DiskWriter streams be configured with the specified configurations. Also allows new DiskWritingParams, run number and dequeue timeout values to be specified. Existing stream configurations will be discarded.

Definition at line 18 of file DiskWriterResources.cc.

References convertSQLiteXML::runNumber.

25  {
26  boost::mutex::scoped_lock sl(streamChangeMutex_);
27 
28  requestedEventStreamConfig_ = evtStrConfig;
29  requestedErrorStreamConfig_ = errStrConfig;
30  requestedDiskWritingParams_ = dwParams;
32  requestedTimeout_ = timeoutValue;
34  streamChangeIsNeeded_ = true;
35  }
boost::posix_time::time_duration requestedTimeout_
EvtStrConfigListPtr requestedEventStreamConfig_
DiskWritingParams requestedDiskWritingParams_
ErrStrConfigListPtr requestedErrorStreamConfig_
void stor::DiskWriterResources::requestStreamDestruction ( )

Requests that the DiskWriter streams be destroyed. Any pending stream configuraton request will be cancelled.

Definition at line 37 of file DiskWriterResources.cc.

References configurationIsNeeded_, streamChangeIsNeeded_, and streamChangeMutex_.

38  {
39  boost::mutex::scoped_lock sl(streamChangeMutex_);
40  configurationIsNeeded_ = false;
41  streamChangeIsNeeded_ = true;
42  }
void stor::DiskWriterResources::setBusy ( bool  isBusyFlag)

Sets the DiskWriter "busy" status to the specified state.

Definition at line 101 of file DiskWriterResources.cc.

References diskWriterIsBusy_.

102  {
103  //boost::mutex::scoped_lock sl(generalMutex_);
104  diskWriterIsBusy_ = isBusyFlag;
105  }
void stor::DiskWriterResources::streamChangeDone ( )

Indicates that the stream configuration change is done.

Definition at line 91 of file DiskWriterResources.cc.

References streamChangeCondition_, streamChangeInProgress_, and streamChangeMutex_.

92  {
93  boost::mutex::scoped_lock sl(streamChangeMutex_);
95  {
96  streamChangeCondition_.notify_one();
97  }
99  }
boost::condition streamChangeCondition_
bool stor::DiskWriterResources::streamChangeOngoing ( )
virtual

Returns true when a stream configuration change is requested or in progress.

Definition at line 85 of file DiskWriterResources.cc.

References streamChangeInProgress_, streamChangeIsNeeded_, and streamChangeMutex_.

86  {
87  boost::mutex::scoped_lock sl(streamChangeMutex_);
89  }
bool stor::DiskWriterResources::streamChangeRequested ( bool &  doConfig,
EvtStrConfigListPtr evtStrConfig,
ErrStrConfigListPtr errStrConfig,
DiskWritingParams dwParams,
unsigned int &  runNumber,
boost::posix_time::time_duration &  timeoutValue 
)

Checks if a request has been made to change the stream configuration in the DiskWriter streams and clears any pending request. Existing streams are purged. If doConfig is true, the supplied new configurations, new run number, and dequeue timeout value should be used to configure a new set of DiskWriter streams.

Definition at line 45 of file DiskWriterResources.cc.

53  {
54  boost::mutex::scoped_lock sl(streamChangeMutex_);
55 
56  if (! streamChangeIsNeeded_) {return false;}
57 
58  streamChangeIsNeeded_ = false;
59 
60  doConfig = configurationIsNeeded_;
62  {
63  configurationIsNeeded_ = false;
64  evtStrConfig = requestedEventStreamConfig_;
65  errStrConfig = requestedErrorStreamConfig_;
66  dwParams = requestedDiskWritingParams_;
68  timeoutValue = requestedTimeout_;
69  }
70 
72 
73  return true;
74  }
boost::posix_time::time_duration requestedTimeout_
EvtStrConfigListPtr requestedEventStreamConfig_
DiskWritingParams requestedDiskWritingParams_
ErrStrConfigListPtr requestedErrorStreamConfig_
void stor::DiskWriterResources::waitForStreamChange ( )
virtual

Waits until a requested stream configuration change has been completed.

Definition at line 76 of file DiskWriterResources.cc.

References streamChangeCondition_, streamChangeInProgress_, streamChangeIsNeeded_, and streamChangeMutex_.

77  {
78  boost::mutex::scoped_lock sl(streamChangeMutex_);
80  {
81  streamChangeCondition_.wait(sl);
82  }
83  }
boost::condition streamChangeCondition_

Member Data Documentation

bool stor::DiskWriterResources::configurationIsNeeded_
private

Definition at line 111 of file DiskWriterResources.h.

Referenced by requestStreamDestruction().

bool stor::DiskWriterResources::diskWriterIsBusy_
private

Definition at line 114 of file DiskWriterResources.h.

Referenced by isBusy(), and setBusy().

bool stor::DiskWriterResources::fileClosingTestIsNeeded_
private

Definition at line 113 of file DiskWriterResources.h.

DiskWritingParams stor::DiskWriterResources::requestedDiskWritingParams_
private

Definition at line 118 of file DiskWriterResources.h.

ErrStrConfigListPtr stor::DiskWriterResources::requestedErrorStreamConfig_
private

Definition at line 117 of file DiskWriterResources.h.

EvtStrConfigListPtr stor::DiskWriterResources::requestedEventStreamConfig_
private

Definition at line 116 of file DiskWriterResources.h.

unsigned int stor::DiskWriterResources::requestedRunNumber_
private

Definition at line 119 of file DiskWriterResources.h.

boost::posix_time::time_duration stor::DiskWriterResources::requestedTimeout_
private

Definition at line 120 of file DiskWriterResources.h.

boost::condition stor::DiskWriterResources::streamChangeCondition_
private

Definition at line 123 of file DiskWriterResources.h.

Referenced by streamChangeDone(), and waitForStreamChange().

bool stor::DiskWriterResources::streamChangeInProgress_
private
bool stor::DiskWriterResources::streamChangeIsNeeded_
private
boost::mutex stor::DiskWriterResources::streamChangeMutex_
mutableprivate