GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4WatchRunnable.cxx
Go to the documentation of this file.
1 // $Id: TGo4WatchRunnable.cxx 1001 2013-07-25 15:10:31Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4WatchRunnable.h"
15 
16 #include "TGo4Log.h"
17 #include "TGo4Thread.h"
18 #include "TGo4ClientStatus.h"
19 
20 const UInt_t TGo4WatchRunnable::fguWATCHINTERVAL=5000;
21 
23 : TGo4Runnable(name,cli)
24 {
25  GO4TRACE((15,"TGo4WatchRunnable::TGo4WatchRunnable(const char*,TGo4ExampleClient*) constructor",__LINE__, __FILE__));
27 }
28 
30 {
31  GO4TRACE((15,"TGo4WatchRunnable::~TGo4WatchRunnable() destructor",__LINE__, __FILE__));
32 
33 }
34 
36 {
37  GO4TRACE((12,"TGo4WatchRunnable::Run()",__LINE__, __FILE__));
38  TGo4ClientTask* cli= dynamic_cast<TGo4ClientTask*> (fxManager);
39  if(cli)
40  {
41  cli->UpdateStatusBuffer(); // will create status object and stream it into TBuffer
42  cli->SendStatusBuffer(); // send TBuffer with most recent client status
43  // note: updating and sending of status buffer may be separated
44  // into different threads. Updating aquires main mutex, sending usually
45  // works without main mutex.
46  if(fxApplication)
47  {
48  cli->SendStatusMessage(1,kTRUE,TString::Format(
49  "Application %s of client %s has been watched",
50  fxApplication->GetName(), cli->GetName()));
51  // method to pass text messages of priorities 0,1,2
52  // (info, warning, error) to the server. kTRUE means additional local printout
53  }
54  }
55  TGo4Thread::Sleep(fguWATCHINTERVAL); // wait for the next update
56  return 0;
57 }
TGo4ExampleApplication * fxApplication
TGo4ThreadManager * fxManager
Definition: TGo4Runnable.h:71
static const UInt_t fguWATCHINTERVAL
static void Sleep(UInt_t millisecs)
Definition: TGo4Thread.cxx:336
virtual Int_t Run(void *)
virtual void SendStatusBuffer()
Definition: TGo4Task.cxx:294
void SendStatusMessage(Int_t level, Bool_t printout, const char *text,...)
Definition: TGo4Task.cxx:303
#define GO4TRACE(X)
Definition: TGo4Log.h:26
void UpdateStatusBuffer()
Definition: TGo4Task.cxx:340
TGo4ExampleApplication * GetApplication()