GSI Object Oriented Online Offline (Go4)
GO4-5.3.2
|
#include <TGo4ServerTask.h>
Public Types | |
enum | ELaunchmodes { kSecureShell = BIT(0), kGuiEmbed = BIT(1) } |
Public Types inherited from TGo4ThreadManager | |
enum | { fguTEXTLENGTH = 256 } |
Public Member Functions | |
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) | |
virtual | ~TGo4ServerTask () |
virtual void | Quit () |
void | Shutdown () |
TGo4TaskManager * | GetTaskManager () |
TGo4TaskHandler * | GetCurrentTaskHandler () |
TGo4TaskHandler * | GetTaskHandler () |
TGo4TaskHandler * | GetTaskHandler (const char *name) |
TGo4BufferQueue * | GetCommandQueue (const char *task=0) |
TGo4BufferQueue * | GetStatusQueue (const char *task=0) |
TGo4BufferQueue * | GetDataQueue (const char *task=0) |
virtual TGo4Command * | NextCommand () |
virtual void | SendStatus (TGo4Status *stat, const char *receiver=0) |
virtual void | SendStatusBuffer () |
virtual Bool_t | StartConnectorThread () |
virtual Bool_t | StopConnectorThread () |
Bool_t | ConnectorThreadIsStopped () |
void | SetCurrentTask (const char *name) |
void | SetConnect (TGo4Socket *trans, const char *host, UInt_t port, Bool_t keepserv=kFALSE) |
void | SetDisConnect (TGo4Socket *trans) |
TGo4Socket * | GetConnectTransport () |
const char * | GetConnectorName () const |
const char * | GetConnectHost () const |
virtual Int_t | TimerConnect () |
virtual Int_t | RemoveAllClients (Bool_t force=false) |
virtual Bool_t | RemoveClient (const char *name, Bool_t clientwait=kTRUE, Bool_t isterminating=kFALSE) |
Bool_t | RemoveCurrentClient () |
Int_t | WaitForOpen () |
Int_t | WaitForClose () |
Int_t | WaitForConnection () |
Public Member Functions inherited from TGo4Task | |
TGo4Task (const char *name, Bool_t blockingmode, Bool_t autostart=kFALSE, Bool_t autocreate=kTRUE, Bool_t ismaster=kFALSE) | |
virtual | ~TGo4Task () |
virtual void | Start () |
virtual void | Stop () |
virtual void | KillMain () |
virtual void | RestartMain () |
virtual void | Terminate (Bool_t termapp=kTRUE) |
virtual void | TerminateFast () |
virtual void | ExecuteString (const char *command) |
Bool_t | IsMaster () |
void | SetOwner (TGo4TaskOwner *owner) |
void | AddUserCommand (TGo4Command *com) |
void | AddUserCommandList (TGo4CommandProtoList *comlist) |
TGo4Status * | NextStatus (Bool_t wait=kTRUE) |
TObject * | NextObject (Bool_t wait=kTRUE) |
void | SendObject (TObject *obj, const char *receiver=0) |
TMutex * | GetStatusBufferMutex () |
void | SendStatusMessage (Int_t level, Bool_t printout, const char *text,...) |
void | UpdateStatusBuffer () |
virtual Int_t | Initialization () |
virtual TGo4TaskStatus * | CreateStatus () |
Bool_t | SubmitCommand (const char *name) |
Bool_t | SubmitEmergencyCommand (Go4EmergencyCommand_t val) |
Bool_t | SubmitEmergencyData (Go4EmergencyCommand_t val, const char *receiver=0) |
Bool_t | SubmitLocalCommand (TGo4Command *com) |
Bool_t | SubmitCommand (TGo4Command *com) |
TGo4Command * | MakeCommand (const char *name) |
void | WakeCommandQueue (Int_t id=0) |
virtual Int_t | StartWorkThreads () |
virtual Int_t | StopWorkThreads () |
Bool_t | IsWorkStopped () |
virtual void | GetStatus () |
const char * | GetCommanderName () const |
TGo4Master * | GetMaster () |
TGo4Slave * | GetSlave () |
void | SendStopBuffers (const char *taskname=0) |
TBuffer * | GetAbortBuffer () |
Public Member Functions inherited from TGo4ThreadManager | |
TGo4ThreadManager (const TGo4ThreadManager &right) | |
TGo4ThreadManager (const char *name, Bool_t blockingmode=kTRUE, Bool_t autostart=kTRUE, Bool_t autocreate=kTRUE) | |
virtual | ~TGo4ThreadManager () |
void | SetTimer (TGo4AppControlTimer *ctrltimer) |
TGo4ThreadHandler * | GetWorkHandler () const |
Bool_t | BlockApp () |
Bool_t | UnBlockApp (Int_t mode=0) |
Bool_t | IsInitDone () const |
Bool_t | IsTerminating () const |
Bool_t | IsTerminateApp () const |
Bool_t | IsAppBlocking () const |
Bool_t | IsBeingQuit () const |
void | SetBeingQuit (Bool_t on) |
void | Launch () |
Public Member Functions inherited from TGo4CommandReceiver | |
virtual | ~TGo4CommandReceiver () |
TGo4CommandReceiver () | |
Static Public Member Functions | |
static const char * | Get_fgcLAUNCHPREFSFILE () |
Static Public Member Functions inherited from TGo4Task | |
static Int_t | Get_fgiTERMID () |
Static Protected Attributes | |
static const Int_t | fgiOPENWAITCYCLES =100 |
static const UInt_t | fguOPENWAITCYCLETIME =100 |
static const Int_t | fgiCLOSEWAITCYCLES =100 |
static const UInt_t | fguCLOSEWAITCYCLETIME =100 |
static const Int_t | fgiCONNECTWAITCYCLES =20 |
static const UInt_t | fguCONNECTWAITCYCLETIME =200 |
static const UInt_t | fguCONNECTTIMERPERIOD =100 |
static const char * | fgcLAUNCHPREFSFILE = "etc/Go4LaunchPrefs.txt" |
Private Attributes | |
TString | fxConnectorName |
TGo4TaskManager * | fxTaskManager |
TGo4TaskHandler * | fxCurrentTaskHandler |
TGo4Socket * | fxConnectTransport |
TGo4Socket * | fxDisConnectTransport |
TString | fxConnectHost |
UInt_t | fuConnectPort |
Bool_t | fbKeepServerSocket |
Bool_t | fbConnectRequest |
Bool_t | fbDisConnectRequest |
Bool_t | fbConnectIsOpen |
Bool_t | fbConnectIsDone |
Bool_t | fbConnectIsClose |
TGo4TaskConnectorTimer * | fxConnectorTimer |
Additional Inherited Members | |
Static Public Attributes inherited from TGo4ThreadManager | |
static const Long_t | fglTIMERPERIOD = 200 |
Protected Member Functions inherited from TGo4Task | |
virtual TGo4TaskHandlerCommandList * | CreateCommandList () |
TGo4TaskHandlerCommandList * | GetPrototype () |
virtual void | UpdateStatus (TGo4TaskStatus *state) |
TGo4ObjectQueue * | GetLocalCommandQueue () |
void | SetMaster (Bool_t on=kTRUE) |
void | SetWorkIsStopped (Bool_t on) |
Protected Attributes inherited from TGo4Task | |
TMutex * | fxStatusMutex |
TBuffer * | fxStatusBuffer |
Protected Attributes inherited from TGo4ThreadManager | |
Bool_t | fbInitDone |
Bool_t | fbTerminating |
Bool_t | fbTerminateApplication |
Bool_t | fbAppBlocking |
Bool_t | fbAutoCreate |
Bool_t | fbAutoStart |
Int_t | fbBeingQuit |
TGo4AppControlTimer * | fxBlocker |
TGo4ThreadHandler * | fxWorkHandler |
Definition at line 28 of file TGo4ServerTask.h.
Enumerator | |
---|---|
kSecureShell | |
kGuiEmbed |
Definition at line 262 of file TGo4ServerTask.h.
TGo4ServerTask::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 |
||
) |
Definition at line 49 of file TGo4ServerTask.cxx.
References fguCONNECTTIMERPERIOD, fxConnectorName, fxConnectorTimer, fxTaskManager, TGo4ThreadManager::fxWorkHandler, GetConnectorName(), TGo4CommandInvoker::Instance(), TGo4ThreadManager::Launch(), TGo4ThreadHandler::NewThread(), and TGo4CommandInvoker::Register().
|
virtual |
Definition at line 93 of file TGo4ServerTask.cxx.
References TGo4ThreadHandler::CancelAll(), fxConnectorTimer, fxTaskManager, TGo4ThreadManager::GetWorkHandler(), and TGo4CommandInvoker::UnRegister().
Bool_t TGo4ServerTask::ConnectorThreadIsStopped | ( | ) |
Returns the waiting state fbIsWaiting of the Connector Thread;
Definition at line 591 of file TGo4ServerTask.cxx.
References GetConnectorName(), TGo4ThreadHandler::GetThread(), TGo4ThreadManager::GetWorkHandler(), and TGo4Thread::IsWaiting().
|
static |
Definition at line 647 of file TGo4ServerTask.cxx.
References fgcLAUNCHPREFSFILE.
Referenced by TGo4ServerProxy::GetLaunchString().
|
virtual |
Reimplemented from TGo4Task.
Definition at line 463 of file TGo4ServerTask.cxx.
References TGo4TaskHandler::GetCommandQueue(), GetCurrentTaskHandler(), and GetTaskHandler().
|
inline |
Definition at line 123 of file TGo4ServerTask.h.
References fxConnectHost.
Referenced by TimerConnect().
|
inline |
Definition at line 121 of file TGo4ServerTask.h.
References fxConnectorName.
Referenced by ConnectorThreadIsStopped(), StartConnectorThread(), StopConnectorThread(), and TGo4ServerTask().
TGo4Socket * TGo4ServerTask::GetConnectTransport | ( | ) |
Definition at line 458 of file TGo4ServerTask.cxx.
References fxConnectTransport.
TGo4TaskHandler * TGo4ServerTask::GetCurrentTaskHandler | ( | ) |
Get task handler of the currently activated client connection
Definition at line 280 of file TGo4ServerTask.cxx.
References fxCurrentTaskHandler.
Referenced by GetCommandQueue(), GetDataQueue(), GetStatusQueue(), GetTaskHandler(), TGo4TaskOwner::IsConnected(), RemoveClient(), RemoveCurrentClient(), TGo4TaskManager::RemoveTaskHandler(), TGo4LoggingRunnable::Run(), and TGo4ControllerRunnable::Run().
|
virtual |
Reimplemented from TGo4Task.
Definition at line 490 of file TGo4ServerTask.cxx.
References GetCurrentTaskHandler(), TGo4TaskHandler::GetDataQueue(), and GetTaskHandler().
Referenced by TGo4ExampleServer::StopWorkThreads().
|
virtual |
Reimplemented from TGo4Task.
Definition at line 476 of file TGo4ServerTask.cxx.
References GetCurrentTaskHandler(), TGo4TaskHandler::GetStatusQueue(), and GetTaskHandler().
Referenced by TGo4ExampleServer::StopWorkThreads().
|
virtual |
Get task handler for client specified by name
Reimplemented from TGo4Task.
Definition at line 275 of file TGo4ServerTask.cxx.
References GetCurrentTaskHandler().
Referenced by GetCommandQueue(), GetDataQueue(), GetStatusQueue(), and RemoveClient().
TGo4TaskHandler * TGo4ServerTask::GetTaskHandler | ( | const char * | name | ) |
Get task handler for client specified by name
Definition at line 270 of file TGo4ServerTask.cxx.
References fxTaskManager, and TGo4TaskManager::GetTaskHandler().
TGo4TaskManager * TGo4ServerTask::GetTaskManager | ( | ) |
Definition at line 285 of file TGo4ServerTask.cxx.
References fxTaskManager.
Referenced by TGo4AnalysisProxy::ConnectorPort(), TGo4TaskOwner::GetTaskManagerMutex(), TGo4AnalysisProxy::LaunchAsClient(), and TGo4ConnectorRunnable::TGo4ConnectorRunnable().
|
virtual |
Delivers next command. This implementation will poll over command queues of all existing connections. Command is labeled with name of ordering task, so data may be returned to command sender only.
Reimplemented from TGo4Task.
Definition at line 504 of file TGo4ServerTask.cxx.
References fxTaskManager, TGo4TaskHandler::GetCommandQueue(), TGo4TaskManager::GetMutex(), TGo4TaskHandler::GetRole(), TGo4Queue::IsEmpty(), TGo4Task::IsMaster(), TGo4TaskManager::NextTaskHandler(), TGo4Command::SetMode(), TGo4Command::SetTaskName(), and TGo4BufferQueue::WaitObjectFromBuffer().
|
virtual |
Quit method used by quit command; may be overridden in special application
Reimplemented from TGo4Task.
Definition at line 597 of file TGo4ServerTask.cxx.
References TGo4Log::Debug(), fxTaskManager, TGo4Task::Get_fgiTERMID(), TGo4TaskManager::GetMutex(), TGo4Task::GetSlave(), TGo4Task::IsMaster(), RemoveAllClients(), TGo4Task::SendStatusMessage(), TGo4Slave::Stop(), TGo4Task::Terminate(), and TGo4Task::WakeCommandQueue().
Referenced by TGo4ComServerQuit::ExeCom().
|
virtual |
Remove all connected client task from this server. with option force=true, remove without waiting
Definition at line 172 of file TGo4ServerTask.cxx.
References fxTaskManager, TGo4TaskManager::NextTaskHandler(), and RemoveClient().
Referenced by Quit(), and Shutdown().
|
virtual |
Remove the client task specified by name from this server. If clientwait=true, remove with client handshake. If isterminating=true, do not restart workthreads after removing the client.
Definition at line 101 of file TGo4ServerTask.cxx.
References TGo4Log::Debug(), TGo4TaskManager::DisConnectClient(), fxTaskManager, GetCurrentTaskHandler(), GetTaskHandler(), TGo4Task::IsMaster(), kComQuit, TGo4Task::SendStopBuffers(), TGo4Task::StartWorkThreads(), TGo4Task::StopWorkThreads(), TGo4Task::SubmitEmergencyCommand(), TGo4Task::SubmitEmergencyData(), and TGo4TaskManager::WaitForClientRemoved().
Referenced by TGo4Master::DisconnectSlave(), TGo4ComRemoveClient::ExeCom(), RemoveAllClients(), and RemoveCurrentClient().
Bool_t TGo4ServerTask::RemoveCurrentClient | ( | ) |
removes the currently active client from server (disconnect)
Definition at line 200 of file TGo4ServerTask.cxx.
References TGo4Log::Debug(), GetCurrentTaskHandler(), and RemoveClient().
|
virtual |
Send status object via status channel to the master. Master name may be specified, if more than one master is connected. By default, object is send to all connected tasks
Reimplemented from TGo4Task.
Definition at line 530 of file TGo4ServerTask.cxx.
References TGo4BufferQueue::AddBufferFromObject(), TGo4Log::Debug(), fxTaskManager, TGo4TaskManager::GetMutex(), TGo4Task::IsMaster(), TGo4TaskManager::NextTaskHandler(), and TGo4Task::SendStatus().
|
virtual |
Send internal status buffer to the master(s).
Reimplemented from TGo4Task.
Definition at line 551 of file TGo4ServerTask.cxx.
References TGo4BufferQueue::AddBuffer(), TGo4Log::Debug(), TGo4Task::fxStatusBuffer, TGo4Task::fxStatusMutex, fxTaskManager, TGo4TaskManager::GetMutex(), TGo4Task::IsMaster(), and TGo4TaskManager::NextTaskHandler().
void TGo4ServerTask::SetConnect | ( | TGo4Socket * | trans, |
const char * | host, | ||
UInt_t | port, | ||
Bool_t | keepserv = kFALSE |
||
) |
Definition at line 290 of file TGo4ServerTask.cxx.
References fbConnectRequest, fbKeepServerSocket, fuConnectPort, fxConnectHost, and fxConnectTransport.
Referenced by TGo4TaskHandler::ConnectServerChannel(), and TGo4TaskManager::ServeClient().
void TGo4ServerTask::SetCurrentTask | ( | const char * | name | ) |
sets current client task (i.e. taskhandler) by name
Definition at line 217 of file TGo4ServerTask.cxx.
References TGo4Log::Debug(), fxCurrentTaskHandler, fxTaskManager, TGo4TaskManager::GetLastTaskHandler(), TGo4TaskManager::GetTaskHandler(), TGo4Task::IsWorkStopped(), TGo4Task::StartWorkThreads(), and TGo4Task::StopWorkThreads().
Referenced by TGo4TaskManager::AddClient(), and TGo4TaskManager::RemoveTaskHandler().
void TGo4ServerTask::SetDisConnect | ( | TGo4Socket * | trans | ) |
Definition at line 299 of file TGo4ServerTask.cxx.
References fbDisConnectRequest, and fxDisConnectTransport.
Referenced by TGo4TaskManager::ServeClient().
void TGo4ServerTask::Shutdown | ( | ) |
Fast Quit() without waiting for proper disconnection. For analysis server shutdown.
Definition at line 621 of file TGo4ServerTask.cxx.
References TGo4Log::Debug(), fguCONNECTTIMERPERIOD, fxTaskManager, TGo4Task::Get_fgiTERMID(), TGo4TaskManager::GetMutex(), TGo4Task::GetSlave(), RemoveAllClients(), TGo4Task::SendStatusMessage(), TGo4TaskOwner::SetTask(), TGo4Thread::Sleep(), TGo4Slave::Stop(), TGo4Task::StopWorkThreads(), and TGo4Task::WakeCommandQueue().
|
virtual |
starts the thread that listens to the connector port for a client negotiation request; used after launching an rsh client from server
Definition at line 570 of file TGo4ServerTask.cxx.
References GetConnectorName(), TGo4ThreadManager::GetWorkHandler(), and TGo4ThreadHandler::Start().
Referenced by TGo4AnalysisProxy::LaunchAsClient().
|
virtual |
stops the thread that listens to the connector port for a client negotiation request; used before launching an rsh client from server. A dummy connection is performed to release socket pending in listening state, thus runnable may wait afterwards , and no server socket is listening on spawning the client. Tests showed that any child process took over the listening server socket, which is not desired here and probably a bug of the system.
Definition at line 575 of file TGo4ServerTask.cxx.
References TGo4Socket::Close(), fxTaskManager, TGo4TaskHandler::Get_fgcERROR(), GetConnectorName(), TGo4TaskManager::GetNegotiationPort(), TGo4ThreadManager::GetWorkHandler(), TGo4Socket::Open(), TGo4Socket::Send(), and TGo4ThreadHandler::Stop().
|
virtual |
this method is used by the connectortimer Notify to connect or disconnect a transportchannel (TSocket) on demand; the connection process itself is handled by the connector runnable which uses services of the TaskManager class
Definition at line 305 of file TGo4ServerTask.cxx.
References TGo4Socket::Close(), fbConnectIsClose, fbConnectIsDone, fbConnectIsOpen, fbConnectRequest, fbDisConnectRequest, fbKeepServerSocket, fuConnectPort, fxConnectTransport, fxDisConnectTransport, GetConnectHost(), TGo4Socket::IsOpen(), and TGo4Socket::Open().
Referenced by TGo4TaskConnectorTimer::Notify().
Int_t TGo4ServerTask::WaitForClose | ( | ) |
Definition at line 410 of file TGo4ServerTask.cxx.
References fbConnectIsClose, fgiCLOSEWAITCYCLES, fguCLOSEWAITCYCLETIME, and TGo4Thread::Sleep().
Referenced by TGo4TaskManager::ServeClient().
Int_t TGo4ServerTask::WaitForConnection | ( | ) |
Definition at line 431 of file TGo4ServerTask.cxx.
References fbConnectIsDone, fguCONNECTWAITCYCLETIME, TGo4ThreadManager::IsTerminating(), and TGo4Thread::Sleep().
Referenced by TGo4TaskHandler::ConnectServerChannel(), and TGo4TaskManager::ServeClient().
Int_t TGo4ServerTask::WaitForOpen | ( | ) |
Definition at line 388 of file TGo4ServerTask.cxx.
References fbConnectIsOpen, fgiOPENWAITCYCLES, fguOPENWAITCYCLETIME, and TGo4Thread::Sleep().
Referenced by TGo4TaskHandler::ConnectServerChannel(), and TGo4TaskManager::ServeClient().
|
private |
True if fxConnectTransport has returned from Close(), i.e. connection was established
Definition at line 252 of file TGo4ServerTask.h.
Referenced by TimerConnect(), and WaitForClose().
|
private |
True if fxConnectTransport has returned from Open(), i.e. connection was established
Definition at line 246 of file TGo4ServerTask.h.
Referenced by TimerConnect(), and WaitForConnection().
|
private |
True if fxConnectTransport waits in server Open() call
Definition at line 240 of file TGo4ServerTask.h.
Referenced by TimerConnect(), and WaitForOpen().
|
private |
True if fxConnectTransport shall be Open() by AppControlTimer
Definition at line 229 of file TGo4ServerTask.h.
Referenced by SetConnect(), and TimerConnect().
|
private |
True if fxConnectTransport shall be Close() by AppControlTimer
Definition at line 234 of file TGo4ServerTask.h.
Referenced by SetDisConnect(), and TimerConnect().
|
private |
True if open in server mode shall keep the server socket instance
Definition at line 224 of file TGo4ServerTask.h.
Referenced by SetConnect(), and TimerConnect().
|
staticprotected |
Name of the Preferences file for the client startup
Definition at line 183 of file TGo4ServerTask.h.
Referenced by Get_fgcLAUNCHPREFSFILE().
|
staticprotected |
maximum cycles to wait until transport is closed
Definition at line 168 of file TGo4ServerTask.h.
Referenced by WaitForClose().
|
staticprotected |
maximum cycles to wait until transport is connected
Definition at line 174 of file TGo4ServerTask.h.
|
staticprotected |
maximum cycles to wait until transport is open
Definition at line 162 of file TGo4ServerTask.h.
Referenced by WaitForOpen().
|
staticprotected |
time for each close wait cycle
Definition at line 171 of file TGo4ServerTask.h.
Referenced by WaitForClose().
|
staticprotected |
period of task connector timer
Definition at line 180 of file TGo4ServerTask.h.
Referenced by Shutdown(), and TGo4ServerTask().
|
staticprotected |
time for each connect wait cycle
Definition at line 177 of file TGo4ServerTask.h.
Referenced by WaitForConnection().
|
staticprotected |
time for each open wait cycle
Definition at line 165 of file TGo4ServerTask.h.
Referenced by WaitForOpen().
|
private |
port number for timer connect
Definition at line 219 of file TGo4ServerTask.h.
Referenced by SetConnect(), and TimerConnect().
|
private |
hostname for timer connect
Definition at line 214 of file TGo4ServerTask.h.
Referenced by GetConnectHost(), and SetConnect().
|
private |
remember name of connector thread
Definition at line 190 of file TGo4ServerTask.h.
Referenced by GetConnectorName(), and TGo4ServerTask().
|
private |
timer responsible for the connection/disconnection of clients; independent of application control timer 1
Definition at line 259 of file TGo4ServerTask.h.
Referenced by TGo4ServerTask(), and ~TGo4ServerTask().
|
private |
link to the next TaskHandler transport instance that shall be connected by the Application Control Timer with the client
Definition at line 203 of file TGo4ServerTask.h.
Referenced by GetConnectTransport(), SetConnect(), and TimerConnect().
|
private |
1
Definition at line 197 of file TGo4ServerTask.h.
Referenced by GetCurrentTaskHandler(), and SetCurrentTask().
|
private |
link to the next TaskHandler transport instance that shall be disconnected by the Application Control Timer with the client
Definition at line 209 of file TGo4ServerTask.h.
Referenced by SetDisConnect(), and TimerConnect().
|
private |
Definition at line 194 of file TGo4ServerTask.h.
Referenced by GetTaskHandler(), GetTaskManager(), NextCommand(), Quit(), RemoveAllClients(), RemoveClient(), SendStatus(), SendStatusBuffer(), SetCurrentTask(), Shutdown(), StopConnectorThread(), TGo4ServerTask(), and ~TGo4ServerTask().