GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4WatchRunnable.cxx
Go to the documentation of this file.
1 // $Id$
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 fuer 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 
19 const UInt_t TGo4WatchRunnable::fguWATCHINTERVAL=5000;
20 
22 : TGo4Runnable(name,cli)
23 {
24  GO4TRACE((15,"TGo4WatchRunnable::TGo4WatchRunnable(const char*,TGo4ExampleClient*) constructor",__LINE__, __FILE__));
26 }
27 
29 {
30  GO4TRACE((15,"TGo4WatchRunnable::~TGo4WatchRunnable() destructor",__LINE__, __FILE__));
31 
32 }
33 
35 {
36  GO4TRACE((12,"TGo4WatchRunnable::Run()",__LINE__, __FILE__));
37  TGo4ClientTask* cli= dynamic_cast<TGo4ClientTask*> (fxManager);
38  if(cli) {
39  cli->UpdateStatusBuffer(); // will create status object and stream it into TBuffer
40  cli->SendStatusBuffer(); // send TBuffer with most recent client status
41  // note: updating and sending of status buffer may be separated
42  // into different threads. Updating aquires main mutex, sending usually
43  // works without main mutex.
44  if(fxApplication) {
45  cli->SendStatusMessage(1, "Application %s of client %s has been watched",
46  fxApplication->GetName(), cli->GetName());
47  // method to pass text messages of priorities 0,1,2
48  // (info, warning, error) to the server. kTRUE means additional local printout
49  }
50  }
51  TGo4Thread::Sleep(fguWATCHINTERVAL); // wait for the next update
52  return 0;
53 }
TGo4ExampleApplication * fxApplication
TGo4ThreadManager * fxManager
Definition: TGo4Runnable.h:70
static const UInt_t fguWATCHINTERVAL
Int_t Run(void *) override
static void Sleep(UInt_t millisecs)
Definition: TGo4Thread.cxx:295
virtual void SendStatusBuffer()
Definition: TGo4Task.cxx:263
void SendStatusMessage(Int_t level, Bool_t printout, const char *text,...)
Definition: TGo4Task.cxx:272
#define GO4TRACE(X)
Definition: TGo4Log.h:25
void UpdateStatusBuffer()
Definition: TGo4Task.cxx:308
TGo4ExampleApplication * GetApplication()