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