objects.storage.storageManager.storageMonitorThread Class Reference

The storageWriterThread class is a long lived worked thread used by the storageManager class, whose job is to do the following things: 1) set the commit flag periodically and 2) check to see that the storage file has not exceeded its size. More...

Inherits objects::logic::common::threads::appThreadBase::appThreadBase.

List of all members.

Public Member Functions

def __init__
def run

Public Attributes

 storageWriterThread
 sleepSoFar
 firstTimeSizeCheck
 killSwitch


Detailed Description

The storageWriterThread class is a long lived worked thread used by the storageManager class, whose job is to do the following things: 1) set the commit flag periodically and 2) check to see that the storage file has not exceeded its size.

Definition at line 83 of file storageManager.py.


Member Function Documentation

def objects.storage.storageManager.storageMonitorThread.__init__ (   self,
  _parent,
  storageWriterThread 
)

Definition at line 85 of file storageManager.py.

00085                                                     :
00086         Thread.__init__(self)
00087         appThreadBase.__init__(self, _parent)
00088         
00089         self.storageWriterThread = storageWriterThread
00090         self.sleepSoFar = 0
00091         
    def run ( self ):

def objects.storage.storageManager.storageMonitorThread.run (   self  ) 

Definition at line 92 of file storageManager.py.

00092                     :
00093         logger.log(__name__ + ": Starting Storage Monitor Timer")
00094         self.firstTimeSizeCheck = True
00095         
00096         try:            
00097             
00098             while(self.killSwitch == False):
00099                 
00100                 self.threadEvent.clear()
00101                 try:                    
00102                     time.sleep(3)
00103                     if self.parent.maxSize != -1:
00104                         self.sleepSoFar += 3                
00105                     self.parent.timeToCommit = True                
00106                                                             
00107                 except Exception, ex:
00108                     logger.log(__name__ + ": There was an error setting storage commit flag. Data will now be commited on this cycle")
00109                     logger.log(ex)   
00110                     
00111                 # could be expensive, so check every 30 seconds
00112                 if self.firstTimeSizeCheck == True or self.sleepSoFar >= 30:
00113                     self.sleepSoFar = 0
00114                     self.firstTimeSizeCheck = False
00115                     
00116                         
00117                     fileSze = self.parent.storageImpl.getStorageSizeBytes()
00118                     if self.parent.maxSize != -1 and fileSze > (self.parent.maxSize * 1000000):
00119                         # kill the storage writer and monitor
00120                         self.storageWriterThread.killSignal()
00121                         self.killSwitch = True
00122                         
00123                         # alert the user that the storage file has exceeded its size
00124                         dlg = wx.MessageDialog(None, "The Trace Storage File has exceeded its maximum allowed size and no more data will be saved.\nTo increase capacity, set a new limit in the application options and restart the monitor", 'Error', wx.ICON_ERROR)
00125                         result = dlg.ShowModal()
00126                         dlg.Destroy()
00127                     else:
00128                        strMsg = "Storage File has not exceeded its max size yet -- Current size is [%d] Bytes" % fileSze
00129                        logger.log(__name__ + ": " + strMsg) 
00130                                             
00131         finally:
00132             self.threadEvent.set()
00133             self.threadEvent.clear()  
00134             logger.log(__name__ + ": Storage Monitor is Done")
00135             
00136             
00137             
00138             
## The storageManager class is responsible for somehow storing a copy of all the captured TCP/IP data


Member Data Documentation

Definition at line 94 of file storageManager.py.

Reimplemented from objects.logic.common.threads.appThreadBase.appThreadBase.

Definition at line 98 of file storageManager.py.

Definition at line 90 of file storageManager.py.

Definition at line 89 of file storageManager.py.


The documentation for this class was generated from the following file:

Generated on Mon Mar 30 00:26:48 2009 for EyeSpy by  doxygen 1.5.8