GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4WatchRunnable.cxx
Go to the documentation of this file.
1 // $Id: TGo4WatchRunnable.cxx 2757 2020-04-16 11:45:21Z 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 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  {
40  cli->UpdateStatusBuffer(); // will create status object and stream it into TBuffer
41  cli->SendStatusBuffer(); // send TBuffer with most recent client status
42  // note: updating and sending of status buffer may be separated
43  // into different threads. Updating aquires main mutex, sending usually
44  // works without main mutex.
45  if(fxApplication)
46  {
47  cli->SendStatusMessage(1,kTRUE,TString::Format(
48  "Application %s of client %s has been watched",
49  fxApplication->GetName(), cli->GetName()));
50  // method to pass text messages of priorities 0,1,2
51  // (info, warning, error) to the server. kTRUE means additional local printout
52  }
53  }
54  TGo4Thread::Sleep(fguWATCHINTERVAL); // wait for the next update
55  return 0;
56 }
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:276
void SendStatusMessage(Int_t level, Bool_t printout, const char *text,...)
Definition: TGo4Task.cxx:285
#define GO4TRACE(X)
Definition: TGo4Log.h:26
void UpdateStatusBuffer()
Definition: TGo4Task.cxx:322
TGo4ExampleApplication * GetApplication()