GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4ServerTask.cxx
Go to the documentation of this file.
1 // $Id: TGo4ServerTask.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 "TGo4ServerTask.h"
15 
16 #include "TMutex.h"
17 #include "TApplication.h"
18 #include "TSystem.h"
19 #include "TObjArray.h"
20 
21 #include "TGo4Log.h"
22 #include "TGo4LockGuard.h"
23 #include "TGo4Socket.h"
24 #include "TGo4BufferQueue.h"
25 #include "TGo4Thread.h"
26 #include "TGo4ThreadHandler.h"
27 #include "TGo4Status.h"
28 #include "TGo4CommandInvoker.h"
29 #include "TGo4TaskManager.h"
30 #include "TGo4TaskHandler.h"
31 #include "TGo4ConnectorRunnable.h"
32 #include "TGo4Slave.h"
33 #include "TGo4TaskConnectorTimer.h"
34 
35 
36 const Int_t TGo4ServerTask::fgiOPENWAITCYCLES=100; // wait cycles (100)
37 const UInt_t TGo4ServerTask::fguOPENWAITCYCLETIME=100; // time in ms (20)
38 const Int_t TGo4ServerTask::fgiCLOSEWAITCYCLES=100; // wait cycles (100)
39 const UInt_t TGo4ServerTask::fguCLOSEWAITCYCLETIME=100; // time in ms (20)
40 const Int_t TGo4ServerTask::fgiCONNECTWAITCYCLES=20; // wait cycles (20)
41 const UInt_t TGo4ServerTask::fguCONNECTWAITCYCLETIME=200; // time in ms (200)
42 const UInt_t TGo4ServerTask::fguCONNECTTIMERPERIOD=100; // time in ms (50)
43 
44 
45 const char* TGo4ServerTask::fgcLAUNCHPREFSFILE = "etc/Go4LaunchPrefs.txt";
46 
47 
49  UInt_t negotiationport,
50  Bool_t blockingmode,
51  Bool_t standalone,
52  Bool_t autostart,
53  Bool_t autocreate,
54  Bool_t ismaster)
55  : TGo4Task(name,blockingmode, autostart,autocreate,ismaster),
56  fxTaskManager(0),fxCurrentTaskHandler(0),
57  fxConnectTransport(0), fxDisConnectTransport(0),
58  fuConnectPort(0), fbKeepServerSocket(kFALSE),
59  fbConnectRequest(kFALSE), fbDisConnectRequest(kFALSE),
60  fbConnectIsOpen(kFALSE),fbConnectIsDone(kFALSE), fbConnectIsClose(kFALSE),
61  fxConnectorTimer(0)
62 {
63  TString nomen("TaskManager of "); nomen += name;
64  fxTaskManager= new TGo4TaskManager(nomen.Data(), this, negotiationport);
65 
66  if(negotiationport!=42)
67  {
68  // connector runnable:
69  nomen.Form("ConnectorRunnable of %s", name);
70  TGo4ConnectorRunnable* conny = new TGo4ConnectorRunnable(nomen.Data(),this);
71  nomen.Form("CONNECTOR-%s", name);
72  fxConnectorName=nomen;
74  }
75  else {} // do not start connector port in local mode <- nameservice problems without wan!
76 
77  TGo4CommandInvoker::Instance(); // make sure a command invoker exists
78  TGo4CommandInvoker::Register("ServerTask", this);
80  fxConnectorTimer->TurnOn();
81  if(standalone)
82  {
83  Launch(); // create threads, start application control timer
84  }
85  else
86  {
87  // subclass must call Launch at end of its ctor
88  }
89 }
90 
91 
93 {
95  delete fxConnectorTimer;
96  delete fxTaskManager;
98 }
99 
100 Bool_t TGo4ServerTask::RemoveClient(const char* name, Bool_t clientwait, Bool_t isterminating)
101 {
102  Bool_t rev=kTRUE;
103  TGo4TaskHandler* taskhandler=0;
104  if(name && strstr(name,"current"))
105  taskhandler=GetCurrentTaskHandler();
106  else
107  taskhandler=GetTaskHandler(name);
108  if(taskhandler==0)
109  {
110  // no such taskhandler for name
111  TGo4Log::Debug(" ServerTask -- RemoveClient FAILED, no client %s !!! ",
112  name);
113  rev=kFALSE;
114  }
115  else // if(taskhandler==0)
116  {
117  TGo4Log::Debug(" ServerTask -- removing client task %s ",name);
118  // first stop all user threads waiting on or writing into the data queues
119  StopWorkThreads();
120  if(clientwait)
121  {
122  // normal mode: handshake with client to be removed
123 
124 
125  // send quit command to client, client will send dummy objects back
126  // to release waiting sockets
127  // then client will request a disconnect action from the connector runnable
128  if(IsMaster())
129  SubmitEmergencyCommand(kComQuit); // master quits client when removing
130  else
131  SubmitEmergencyData(kComQuit, taskhandler->GetName()); // client data runnable must handle quit request of server!
132  TGo4Log::Debug(" Server Task -- Waiting for client %s disconnection...",taskhandler->GetName());
133  Int_t removeresult=fxTaskManager->WaitForClientRemoved();
134  // disconnection is done by connector
135  // thread using task manager methods
136  switch(removeresult)
137  {
138  case -1:
139  // timeout
140  TGo4Log::Debug(" !!! Server Task -- client remove wait TIMEOUT !!! ");
141  rev=fxTaskManager->DisConnectClient(taskhandler->GetName(),kFALSE); // do not wait for client ok
142  break;
143 
144  case -2:
145  // we are terminating the server
146  TGo4Log::Debug(" !!! Server Task -- client remove aborted for TERMINATION MODE !!! ");
147  rev=kFALSE;
148  break;
149 
150  default:
151  // all right
152  TGo4Log::Debug(" Server Task -- waited %d cycles until client was removed. ",removeresult);
153  rev=kTRUE;
154  break;
155 
156  }
157  } // if(clientwait)
158  else
159  {
160  // no communication with client, just disconnect without waiting
161  TGo4Log::Debug(" !!! Server Task -- removing client %s without waiting... ",
162  taskhandler->GetName());
163  SendStopBuffers(taskhandler->GetName());
164  rev= (fxTaskManager->DisConnectClient(taskhandler->GetName(),kFALSE)==0); // do not wait
165  }
166  if(!isterminating) StartWorkThreads();
167  } // else if(taskhandler==0)
168  return rev;
169 }
170 
172 {
173  Int_t rev=0; // return value is number of removed clients
174  //std::cout <<"TTTTTTTT TGo4ServerTask::RemoveAllClients" << std::endl;
176  TGo4TaskHandler* taskhandler=0;
177  TObjArray names;
178  Bool_t reset=kTRUE;
179  while((taskhandler=fxTaskManager->NextTaskHandler(reset)) !=0)
180  {
181  reset=kFALSE;
182  //std::cout <<"adding name "<<taskhandler->GetName() << std::endl;
183  names.AddLast(new TNamed(taskhandler->GetName(), "title"));
184  }
185  TIter niter(&names);
186  TObject* nomen=0;
187  while((nomen =niter.Next()) !=0)
188  {
189  //std::cout <<"removing th "<<nomen->GetName() << std::endl;
190  RemoveClient(nomen->GetName(),!force,kTRUE);
191  rev++;
192  }
193  names.Delete();
194  // end iteration
195  return rev;
196 }
197 
198 
200 {
201  Bool_t rev=kTRUE;
202  TGo4TaskHandler* taskhandler=GetCurrentTaskHandler();
203  if(taskhandler!=0)
204  {
205  // we have a current client, remove it
206  TGo4Log::Debug(" Server task -- removing current client %s ",taskhandler->GetName());
207  rev = RemoveClient(taskhandler->GetName());
208  }
209  else
210  {
211  rev=kFALSE;
212  }
213  return rev;
214 }
215 
216 void TGo4ServerTask::SetCurrentTask(const char* name)
217 {
218  //std::cout <<"server task setting current task to "<<name << std::endl;
219  TGo4TaskHandler* han=0;
220  if(fxTaskManager==0)
221  {
222  TGo4Log::Debug(" TGo4ServerTask ''%s'' ERROR- task manager not existing!!! ");
223  }
224  else
225  {
226  // first stop all user threads waiting on or writing into the data queues
227  if(IsWorkStopped())
228  {
229  // Working threads have already been stopped
230  // maybe by RemoveClient method.
231  // We do nothing, since the current taskhandler is not
232  // reset yet and any access to current task in the derived
233  // _user_ method would crash the program!
234  }
235  else // if(IsWorkStopped())
236  {
237  // work has not been stopped, we do that
238  StopWorkThreads();
239  } // else if(fbWorkIsStopped)
240  {
241  if(name==0)
242  {
243  // zero name given, set pointer to last handler still in list
245  //std::cout << "**** set current th from get lastth:"<< fxCurrentTaskHandler << std::endl;
246  }
247  else // if(name==0)
248  {
249  // name specified, search for it
250  han=fxTaskManager->GetTaskHandler(name);
251  if(han)
252  {
254  //std::cout << "**** set current th from name:"<< fxCurrentTaskHandler << std::endl;
255  }
256  else // if(han)
257  {
258  TGo4Log::Debug(" ServerTask: FAILED setting current task to %s-- no such client! ",name);
259  } // else if(han)
260  } // else if(name==0)
261 
262  } // TGo4LockGuard
263  // finally, start user threads again
265  } // else if(fxTaskManager==0)
266 }
267 
268 
270 {
271  return (fxTaskManager->GetTaskHandler(name));
272 }
273 
275 {
276  return (GetCurrentTaskHandler());
277 }
278 
280 {
281  return fxCurrentTaskHandler;
282 }
283 
285 {
286  return fxTaskManager;
287 }
288 
289 void TGo4ServerTask::SetConnect(TGo4Socket * trans, const char* host, UInt_t port, Bool_t keepserv)
290 {
291  fxConnectTransport=trans;
292  fxConnectHost=host;
293  fuConnectPort=port;
294  fbConnectRequest=kTRUE;
295  fbKeepServerSocket=keepserv;
296 }
297 
299 {
300  fxDisConnectTransport=trans;
301  fbDisConnectRequest=kTRUE;
302 }
303 
305 {
306  Int_t rev=0;
310  {
311  if(fxDisConnectTransport!=0)
312  {
313  // we have a transport instance to disconnect
315  //delete fxDisConnectTransport; // new
316  //std::cout << "++++++++Timer closed transport"<< std::endl;
317  fbConnectIsClose=kTRUE;
318  fbDisConnectRequest=kFALSE; // we served the request, reset it
319  rev+=1;
320  }
321  else
322  {
323  // error, zero pointer given
324  rev+=32;
325  }
326  }
327  else
328  {
329  // no open request, continue
330  rev+=2;
331  }
332 
335  if(fbConnectRequest)
336  {
337  // timer shall open a transport as server
338  if(fxConnectTransport!=0)
339  {
340 
341  if(!fxConnectTransport->IsOpen())
342  {
343  // transport is not open, so do it
344 // std::cout << "++++++++Timer will open transport"<< std::endl;
345  fbConnectIsOpen=kTRUE; // tell connector thread that we try to open
347  if(result==0)
348  {
349  fbConnectIsDone=kTRUE; // tell connector thread we returned from open
350  fbConnectRequest=kFALSE; // we served the request, reset it
351  fbKeepServerSocket=kFALSE; // reset keep server socket flag
352  rev+=4;
353  }
354  else
355  {
356  rev=-4;
357  // open was not finished, we poll once again...
358  }
359  }
360  else
361  {
362  // transport was already open
363 // std::cout <<"OOOOOOOOOOOO TimerConnect transport already open!" << std::endl;
364  fbConnectIsOpen=kTRUE;
365  fbConnectIsDone=kTRUE; // tell connector thread we returned from open
366  fbConnectRequest=kFALSE; // we served the request, reset it
367  fbKeepServerSocket=kFALSE; // reset keep server socket flag
368  rev+=8;
369  }
370  } // if(fxConnectTransport!=0)
371  else
372  {
373  rev+=64;
374  // no Transport specified: create raw server for negotiation port
375  //fxConnectTransport=new TGo4Socket("Server",3);
376  //std::cout << "(((((( timer created new raw server transport"<< std::endl;
377  }
378  }
379  else
380  {
381  // no open request, continue
382  rev+=16;
383  }
384  return rev;
385 }
386 
388 {
389  Int_t count=0;
390  while(!fbConnectIsOpen)
391  {
393  {
394  count = -1; // timeout
395  break;
396  }
397  else
398  {
400  ++count;
401  }
402 // std::cout << "*****WaitForOpen()"<< std::endl;
403  }
404  fbConnectIsOpen=kFALSE; // reset for next time
405  return count;
406 }
407 
408 
410 {
411  Int_t count=0;
412  while(!fbConnectIsClose)
413  {
415  {
416  count = -1; // timeout
417  break;
418  }
419  else
420  {
422  ++count;
423  }
424  //std::cout << "*****WaitForClose() "<<count<< std::endl;
425  }
426  fbConnectIsClose=kFALSE; // reset for next time
427  return count;
428 }
429 
431 {
432  Int_t count=0;
433  while(!fbConnectIsDone)
434  {
435  if(IsTerminating())
436  {
437  count = -2; // termination mode
438  break;
439  }
440 // timeout would affect the permanent connector port Open , we skip this
441 // else if(count>TGo4ServerTask::fgiCONNECTWAITCYCLES)
442 // {
443 // count = -1; // timeout
444 // break;
445 // }
446  else
447  {
449  ++count;
450  }
451 // std::cout << "*****WaitForConnection()"<< std::endl;
452  }
453  fbConnectIsDone=kFALSE; // reset for next time
454  return count;
455 }
456 
458 {
459  return fxConnectTransport;
460 }
461 
463 {
464  TGo4BufferQueue* queue=0;
465  TGo4TaskHandler* currenttask=0;
466  if(name==0 || strstr(name,"current"))
467  currenttask=GetCurrentTaskHandler(); // find out the current client
468  else
469  currenttask=GetTaskHandler(name); // find out destination client by name
470  if(currenttask)
471  queue=dynamic_cast<TGo4BufferQueue*> (currenttask->GetCommandQueue());
472  return queue;
473 }
474 
476 {
477  TGo4BufferQueue* queue=0;
478  TGo4TaskHandler* currenttask=0;
479  if(name==0)
480  currenttask=GetCurrentTaskHandler(); // find out the current client
481  else
482  currenttask=GetTaskHandler(name); // find out destination client by name
483  if(currenttask)
484  queue=dynamic_cast<TGo4BufferQueue*> (currenttask->GetStatusQueue());
485  return queue;
486 }
487 
488 
490 {
491  TGo4BufferQueue* queue=0;
492  TGo4TaskHandler* currenttask=0;
493  if(name==0 || strstr(name,"current"))
494  currenttask=GetCurrentTaskHandler(); // find out the current client
495  else
496  currenttask=GetTaskHandler(name); // find out destination client by name
497  if(currenttask)
498  queue=dynamic_cast<TGo4BufferQueue*> (currenttask->GetDataQueue());
499  return queue;
500 
501 }
502 
504 {
505 if(IsMaster()) return 0;
506 TGo4Command* com=0;
507 TGo4TaskHandler* han=0;
508 Bool_t reset=kTRUE;
509 TGo4LockGuard taskmutex(fxTaskManager->GetMutex());
510 while((han=fxTaskManager->NextTaskHandler(reset))!=0)
511  {
512  reset=kFALSE;
513  TGo4BufferQueue * comq=dynamic_cast<TGo4BufferQueue*> (han->GetCommandQueue());
514  if(comq==0) continue; //NEVER COME HERE!
515  if(!comq->IsEmpty()) // prevent waiting on queue
516  {
517  com= dynamic_cast<TGo4Command*>(comq->WaitObjectFromBuffer());
518  if(com)
519  {
520  com->SetTaskName(han->GetName());
521  com->SetMode(han->GetRole());
522  return com;
523  }
524  }
525  } // while
526 return com;
527 }
528 
529 void TGo4ServerTask::SendStatus(TGo4Status * stat, const char* receiver)
530 {
531  if(IsMaster()) return;
532  if(stat==0) return;
533  if(receiver!=0) {
534  TGo4Task::SendStatus(stat,receiver);
535  return;
536  }
537  // send status to all
538  TGo4LockGuard taskmutex(fxTaskManager->GetMutex());
539  TGo4TaskHandler* han = 0;
540  Bool_t reset = kTRUE;
541  while((han = fxTaskManager->NextTaskHandler(reset))!=0) {
542  reset = kFALSE;
543  TGo4BufferQueue * statq=dynamic_cast<TGo4BufferQueue*> (han->GetStatusQueue());
544  if(statq==0) continue; //NEVER COME HERE!
545  TGo4Log::Debug(" Task - sending status %s to task %s", stat->ClassName(), han->GetName());
546  statq->AddBufferFromObject(stat);
547  }// while
548 }
549 
551 {
552  if(IsMaster()) return;
553  TGo4LockGuard statguard(fxStatusMutex); // do not send during buffer update
554  TGo4LockGuard taskmutex(fxTaskManager->GetMutex()); // protect task list
555  TGo4TaskHandler* han=0;
556  Bool_t reset=kTRUE;
557  while((han=fxTaskManager->NextTaskHandler(reset))!=0)
558  {
559  reset=kFALSE;
560  TGo4BufferQueue * statq=dynamic_cast<TGo4BufferQueue*> (han->GetStatusQueue());
561  if(statq==0) continue; //NEVER COME HERE!
562  TGo4Log::Debug(" Task - sending status buffer to task %s", han->GetName());
563  statq->AddBuffer(fxStatusBuffer,kTRUE);
564  }// while
565 }
566 
567 
568 
570 {
571  return GetWorkHandler()->Start( GetConnectorName() );
572 }
573 
575 {
576  Bool_t rev = GetWorkHandler()->Stop( GetConnectorName() ); // unset running flag
577  // now establish a dummy connection to our own server to release the listen socket:
578  const char* host = gSystem->HostName();
579  Int_t negotiationport = fxTaskManager->GetNegotiationPort();
580  TGo4Socket* connector = new TGo4Socket(kTRUE); // raw socket transport
581  //std::cout << "host:"<<host<<" , port:" << negotiationport << std::endl;
582  connector->Open(host,negotiationport); // open connection to server's connector runnable
583  connector->Send(TGo4TaskHandler::Get_fgcERROR()); // force server to stop
584  connector->Close();
585  delete connector;
586  return rev;
587 }
588 
589 
591 {
593  return conny->IsWaiting();
594 }
595 
597 {
598  TGo4Log::Debug(" ServerTask Quit -- removing all connected clients ");
599  SendStatusMessage(2,kTRUE,"ServerTask %s is shutting down now! All clients are removed...",GetName());
600  TGo4Slave* slave=GetSlave();
601  if(slave)
602  {
603  TGo4Log::Debug(" ServerTask Quit is stopping slave...");
604  slave->Stop(); // to execute analysis postloop if still running
605  }
606  if(!IsMaster())
607  {
608  //std::cout <<"mmmmmmmmm quit is unlocking taskmanager mutex" << std::endl;
609  fxTaskManager->GetMutex()->UnLock(); // JAM avoid deadlocking of analysis server main thread with connector thread that actually performs the remove
610  }
612  //StopWorkThreads(); // are re-started after last client is removed...
613  WakeCommandQueue(TGo4Task::Get_fgiTERMID()); // will stop local command thread, and remote
614  Terminate(!IsMaster()); // terminate only slave server here!
615 // if(!IsMaster())
616 // fxTaskManager->GetMutex()->Lock(); // avoid conflicts with lockguard outside
617 }
618 
619 
621 {
622  TGo4Log::Debug(" ServerTask Shutdown without disconnect waiting");
623  SendStatusMessage(2,kTRUE,"ServerTask %s is shutting down now! All clients are removed...",GetName());
624  fxTaskManager->GetMutex()->UnLock(); // avoid possible deadlock between main thread and connector thread
625  TGo4Thread::Sleep(10*fguCONNECTTIMERPERIOD); // wait 1 s to broadcast shutdown message before terminating...
626  StopWorkThreads();
627  WakeCommandQueue(TGo4Task::Get_fgiTERMID()); // will stop local command thread, and remote
628 
629  RemoveAllClients(true);
630 
631  TGo4Slave* slave=GetSlave();
632  if(slave)
633  {
634  TGo4Log::Debug(" ServerTask Shutdown stopping slave...");
635  slave->Stop(); // to execute analysis postloop.
636  // We are within main thread here, i.e. it never stops before termination!
637  slave->SetTask(0,kFALSE); // otherwise owner dtor will delete us...
638  delete slave; //call dtors of analysis framework
639  //SetOwner(0);
640  }
641  fxTaskManager->GetMutex()->Lock();
642  gApplication->Terminate(); // do not wait until appctrl timer terminates us
643 }
644 
645 
647 {
648  return fgcLAUNCHPREFSFILE;
649 }
650 
651 
virtual Bool_t RemoveClient(const char *name, Bool_t clientwait=kTRUE, Bool_t isterminating=kFALSE)
virtual void SendStatus(TGo4Status *stat, const char *receiver=0)
TString fxConnectorName
Bool_t IsWorkStopped()
Definition: TGo4Task.h:242
TGo4Thread * GetThread(const char *name)
Bool_t fbDisConnectRequest
virtual Int_t StartWorkThreads()
Definition: TGo4Task.cxx:569
virtual Int_t Close(Option_t *opt="")
Definition: TGo4Socket.cxx:212
TObject * WaitObjectFromBuffer()
TGo4TaskHandler * NextTaskHandler(Bool_t reset=kFALSE)
void WakeCommandQueue(Int_t id=0)
Definition: TGo4Task.cxx:543
virtual void SendStatusBuffer()
static const UInt_t fguCONNECTWAITCYCLETIME
virtual Int_t Send(TObject *obj)
Definition: TGo4Socket.cxx:338
Int_t WaitForConnection()
static void UnRegister(TGo4CommandReceiver *p)
UInt_t GetNegotiationPort()
TGo4ThreadHandler * fxWorkHandler
void SetTaskName(const char *)
Bool_t RemoveCurrentClient()
TGo4Queue * GetStatusQueue() const
void SetDisConnect(TGo4Socket *trans)
static const char * Get_fgcERROR()
TGo4TaskConnectorTimer * fxConnectorTimer
static void Sleep(UInt_t millisecs)
Definition: TGo4Thread.cxx:335
Bool_t fbConnectIsOpen
static void Register(const char *name, TGo4CommandReceiver *p)
void SendStopBuffers(const char *taskname=0)
Definition: TGo4Task.cxx:581
virtual Int_t Open(const char *host, Int_t port, Bool_t keepservsock=kFALSE)
Definition: TGo4Socket.cxx:92
virtual void Quit()
Bool_t NewThread(const char *name, TGo4Runnable *runnable)
TGo4Queue * GetCommandQueue() const
virtual Int_t StopWorkThreads()
Definition: TGo4Task.cxx:575
void SetConnect(TGo4Socket *trans, const char *host, UInt_t port, Bool_t keepserv=kFALSE)
Bool_t IsWaiting() const
Definition: TGo4Thread.h:86
TGo4TaskHandler * fxCurrentTaskHandler
Bool_t fbConnectIsDone
virtual Bool_t StopConnectorThread()
static const UInt_t fguCONNECTTIMERPERIOD
virtual void Stop()
Definition: TGo4Slave.cxx:73
virtual TGo4Command * NextCommand()
TGo4Socket * fxDisConnectTransport
static const UInt_t fguCLOSEWAITCYCLETIME
Bool_t IsEmpty()
Definition: TGo4Queue.cxx:84
TGo4Slave * GetSlave()
Definition: TGo4Task.h:255
virtual Int_t TimerConnect()
static const char * Get_fgcLAUNCHPREFSFILE()
const char * GetConnectHost() const
Int_t DisConnectClient(const char *name, Bool_t clientwait=kTRUE)
TGo4Queue * GetDataQueue() const
virtual void SendStatus(TGo4Status *stat, const char *receiver=0)
Definition: TGo4Task.cxx:259
static TGo4CommandInvoker * Instance()
TGo4BufferQueue * GetStatusQueue(const char *task=0)
static const Int_t fgiCONNECTWAITCYCLES
TGo4TaskHandler * GetTaskHandler(const char *name)
TString fxConnectHost
static const UInt_t fguOPENWAITCYCLETIME
TGo4ThreadHandler * GetWorkHandler() const
TMutex * fxStatusMutex
Definition: TGo4Task.h:295
Bool_t SubmitEmergencyCommand(Go4EmergencyCommand_t val)
Definition: TGo4Task.cxx:452
static const Int_t fgiOPENWAITCYCLES
TMutex * GetMutex()
void AddBuffer(TBuffer *buffer, Bool_t clone=kFALSE)
Bool_t Stop(const char *thname)
Bool_t ConnectorThreadIsStopped()
Bool_t Start(const char *thname)
TBuffer * fxStatusBuffer
Definition: TGo4Task.h:298
void SendStatusMessage(Int_t level, Bool_t printout, const char *text,...)
Definition: TGo4Task.cxx:285
Bool_t fbKeepServerSocket
TGo4ServerTask(const char *name, UInt_t negotiationport=0, Bool_t blockingmode=kFALSE, Bool_t standalone=kFALSE, Bool_t autostart=kTRUE, Bool_t autocreate=kTRUE, Bool_t ismaster=kTRUE)
TGo4Socket * GetConnectTransport()
TGo4BufferQueue * GetCommandQueue(const char *task=0)
virtual void Terminate(Bool_t termapp=kTRUE)
Definition: TGo4Task.cxx:131
Bool_t fbConnectRequest
TGo4TaskManager * fxTaskManager
Go4CommandMode_t GetRole()
virtual Int_t RemoveAllClients(Bool_t force=false)
void SetTask(TGo4Task *task, Bool_t delold=kTRUE)
static const Int_t fgiCLOSEWAITCYCLES
TGo4BufferQueue * GetDataQueue(const char *task=0)
TGo4TaskHandler * GetLastTaskHandler()
virtual ~TGo4ServerTask()
Bool_t fbConnectIsClose
Bool_t IsTerminating() const
static Int_t Get_fgiTERMID()
Definition: TGo4Task.cxx:611
Bool_t IsOpen() const
Definition: TGo4Socket.h:36
void SetMode(Go4CommandMode_t m)
Definition: TGo4Command.h:83
TGo4TaskHandler * GetCurrentTaskHandler()
Int_t WaitForClientRemoved()
void SetCurrentTask(const char *name)
static const char * fgcLAUNCHPREFSFILE
Bool_t SubmitEmergencyData(Go4EmergencyCommand_t val, const char *receiver=0)
Definition: TGo4Task.cxx:474
void AddBufferFromObject(TObject *object)
TGo4TaskHandler * GetTaskHandler()
TGo4TaskManager * GetTaskManager()
TGo4Socket * fxConnectTransport
static void Debug(const char *text,...)
Definition: TGo4Log.cxx:274
Bool_t IsMaster()
Definition: TGo4Task.h:93
const char * GetConnectorName() const
virtual Bool_t StartConnectorThread()