GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4TaskManager Class Reference

Task manager. More...

#include <TGo4TaskManager.h>

+ Inheritance diagram for TGo4TaskManager:

Public Member Functions

 TGo4TaskManager (const char *name, TGo4ServerTask *server, UInt_t negotiationport=0, Bool_t createconnector=kTRUE)
 
virtual ~TGo4TaskManager ()
 
Bool_t AddClient (const char *client, const char *host, Go4CommandMode_t role)
 adds client task of name to manager: create server task handler and try to connect to client Command execution role depends on previous login passowrd
 
Bool_t AddTaskHandler (TGo4TaskHandler *han)
 adds external task handler to array
 
Go4CommandMode_t ClientLogin ()
 Check account and password of the client that requests a connection to this server.
 
Int_t ConnectClient (const char *client, const char *host, Go4CommandMode_t role=kGo4ComModeController)
 used by connector runnable to wait for a client request to connect to this server task.
 
Int_t DisConnectClient (const char *name, Bool_t clientwait=kTRUE)
 disonnect an existing client by name, wait for negotiation OK if clientwait is true
 
Int_t DisConnectClient (TGo4TaskHandler *taskhandler, Bool_t clientwait=kTRUE)
 disonnect an existing client by name, wait for negotiation OK if clientwait is true
 
TGo4TaskHandlerGetLastTaskHandler ()
 returns last task handler in list
 
TMutex * GetMutex ()
 
UInt_t GetNegotiationPort ()
 returns the portnumber for client server negotiation port which is actually used by the running taskmanager
 
UInt_t GetTaskCount () const
 Number of entries in taskhandler list, i.e.
 
TGo4TaskHandlerGetTaskHandler (const char *name)
 returns certain task handler by name
 
Bool_t HasControllerTask ()
 
TGo4TaskHandlerNewTaskHandler (const char *name)
 creates new task handler with given name and adds it into array
 
TGo4TaskHandlerNextTaskHandler (Bool_t reset=kFALSE)
 For iteration over all connected task handlers.
 
Bool_t RemoveTaskHandler (const char *name)
 removes task handler from array by name
 
Int_t ServeClient ()
 used by connector runnable to wait for a client connect/disonnect request
 
Int_t WaitForClientRemoved ()
 

Static Public Attributes

static const Int_t fgiDISCONCYCLES =360
 cycles to wait for client disconnection
 
static const UInt_t fguDISCONTIME =500
 time for each disonnection wait cycle
 

Private Member Functions

 TGo4TaskManager ()
 
 TGo4TaskManager (const TGo4TaskManager &right)
 

Private Attributes

Bool_t fbClientIsRemoved {kFALSE}
 True if the last specified client is removed from server.
 
Bool_t fbHasControllerConnection {kFALSE}
 True if this server already has one connection to a master client that has the controller role.
 
UInt_t fuNegotiationPort {0}
 port number for the server client negotiation connections
 
UInt_t fuTaskCount {0}
 
TMutex * fxListMutex {nullptr}
 
TGo4ServerTaskfxServer {nullptr}
 
TIterator * fxTaskIter {nullptr}
 Iterator over list of tasks.
 
TObjArray * fxTaskList {nullptr}
 
TGo4SocketfxTransport {nullptr}
 

Detailed Description

Task manager.

Definition at line 31 of file TGo4TaskManager.h.

Constructor & Destructor Documentation

◆ TGo4TaskManager() [1/3]

TGo4TaskManager::TGo4TaskManager ( const char * name,
TGo4ServerTask * server,
UInt_t negotiationport = 0,
Bool_t createconnector = kTRUE )

◆ ~TGo4TaskManager()

TGo4TaskManager::~TGo4TaskManager ( )
virtual

Definition at line 68 of file TGo4TaskManager.cxx.

References fxListMutex, fxTaskIter, fxTaskList, and fxTransport.

◆ TGo4TaskManager() [2/3]

TGo4TaskManager::TGo4TaskManager ( )
private

◆ TGo4TaskManager() [3/3]

TGo4TaskManager::TGo4TaskManager ( const TGo4TaskManager & right)
private

References TGo4TaskManager().

Member Function Documentation

◆ AddClient()

Bool_t TGo4TaskManager::AddClient ( const char * client,
const char * host,
Go4CommandMode_t role )

◆ AddTaskHandler()

Bool_t TGo4TaskManager::AddTaskHandler ( TGo4TaskHandler * han)

adds external task handler to array

Definition at line 376 of file TGo4TaskManager.cxx.

References fxListMutex, fxTaskList, and TGo4LockGuard.

Referenced by NewTaskHandler().

◆ ClientLogin()

Go4CommandMode_t TGo4TaskManager::ClientLogin ( )

Check account and password of the client that requests a connection to this server.

Return value specifies client access priorities as defined in TGo4Command.h Returns 0 in case of incorrect login.

Definition at line 204 of file TGo4TaskManager.cxx.

References TGo4Log::Debug(), fbHasControllerConnection, TGo4TaskHandler::fgcMASTER, TGo4TaskHandler::fgcSLAVE, TGo4TaskHandler::fgxADMINISTRATORACCOUNT, TGo4TaskHandler::fgxCONTROLLERACCOUNT, TGo4TaskHandler::fgxOBSERVERACCOUNT, fxServer, fxTransport, TGo4TaskHandler::Get_fgcOK(), kGo4ComModeAdministrator, kGo4ComModeController, kGo4ComModeObserver, kGo4ComModeRefused, and TGo4Log::Warn().

Referenced by ServeClient().

◆ ConnectClient()

Int_t TGo4TaskManager::ConnectClient ( const char * client,
const char * host,
Go4CommandMode_t role = kGo4ComModeController )

used by connector runnable to wait for a client request to connect to this server task.

May specify mode of allowed commands in case of client is master.

Definition at line 284 of file TGo4TaskManager.cxx.

References AddClient().

Referenced by ServeClient().

◆ DisConnectClient() [1/2]

Int_t TGo4TaskManager::DisConnectClient ( const char * name,
Bool_t clientwait = kTRUE )

disonnect an existing client by name, wait for negotiation OK if clientwait is true

Definition at line 294 of file TGo4TaskManager.cxx.

References DisConnectClient(), GetTaskHandler(), and TGo4Log::Info().

Referenced by DisConnectClient(), and ServeClient().

◆ DisConnectClient() [2/2]

Int_t TGo4TaskManager::DisConnectClient ( TGo4TaskHandler * taskhandler,
Bool_t clientwait = kTRUE )

◆ GetLastTaskHandler()

TGo4TaskHandler * TGo4TaskManager::GetLastTaskHandler ( )

returns last task handler in list

Definition at line 445 of file TGo4TaskManager.cxx.

References fxListMutex, fxTaskList, and TGo4LockGuard.

◆ GetMutex()

TMutex * TGo4TaskManager::GetMutex ( )
inline

Definition at line 107 of file TGo4TaskManager.h.

References fxListMutex.

Referenced by TGo4TaskOwner::GetTaskManagerMutex().

◆ GetNegotiationPort()

UInt_t TGo4TaskManager::GetNegotiationPort ( )

returns the portnumber for client server negotiation port which is actually used by the running taskmanager

Definition at line 480 of file TGo4TaskManager.cxx.

References fuNegotiationPort, and fxTransport.

Referenced by TGo4AnalysisProxy::ConnectorPort(), TGo4AnalysisProxy::LaunchAsClient(), and ServeClient().

◆ GetTaskCount()

UInt_t TGo4TaskManager::GetTaskCount ( ) const
inline

Number of entries in taskhandler list, i.e.

number of connected clients

Definition at line 110 of file TGo4TaskManager.h.

References fuTaskCount.

◆ GetTaskHandler()

TGo4TaskHandler * TGo4TaskManager::GetTaskHandler ( const char * name)

returns certain task handler by name

Definition at line 435 of file TGo4TaskManager.cxx.

References fxListMutex, fxTaskList, and TGo4LockGuard.

Referenced by DisConnectClient().

◆ HasControllerTask()

Bool_t TGo4TaskManager::HasControllerTask ( )
inline

Definition at line 122 of file TGo4TaskManager.h.

References fbHasControllerConnection.

◆ NewTaskHandler()

TGo4TaskHandler * TGo4TaskManager::NewTaskHandler ( const char * name)

creates new task handler with given name and adds it into array

Definition at line 395 of file TGo4TaskManager.cxx.

References AddTaskHandler(), and fxServer.

Referenced by AddClient().

◆ NextTaskHandler()

TGo4TaskHandler * TGo4TaskManager::NextTaskHandler ( Bool_t reset = kFALSE)

For iteration over all connected task handlers.

If reset is true, internal iterator will be reset. Otherwies, continue iterating list until last entry. Returns 0 when iteration finishes.

Definition at line 455 of file TGo4TaskManager.cxx.

References fxListMutex, fxTaskIter, and TGo4LockGuard.

◆ RemoveTaskHandler()

Bool_t TGo4TaskManager::RemoveTaskHandler ( const char * name)

removes task handler from array by name

Definition at line 406 of file TGo4TaskManager.cxx.

References fxListMutex, fxServer, fxTaskList, and TGo4LockGuard.

Referenced by AddClient(), and DisConnectClient().

◆ ServeClient()

◆ WaitForClientRemoved()

Int_t TGo4TaskManager::WaitForClientRemoved ( )

Field Documentation

◆ fbClientIsRemoved

Bool_t TGo4TaskManager::fbClientIsRemoved {kFALSE}
private

True if the last specified client is removed from server.

flag is set by connector thread who performs the DisconnectClient of TaskManager; is reset by WaitForClientRemoved method.

Definition at line 161 of file TGo4TaskManager.h.

Referenced by TGo4TaskManager(), DisConnectClient(), and WaitForClientRemoved().

◆ fbHasControllerConnection

Bool_t TGo4TaskManager::fbHasControllerConnection {kFALSE}
private

True if this server already has one connection to a master client that has the controller role.

Only one controller or administrator taskhandler is allowed per server.

Definition at line 166 of file TGo4TaskManager.h.

Referenced by TGo4TaskManager(), AddClient(), ClientLogin(), DisConnectClient(), and HasControllerTask().

◆ fgiDISCONCYCLES

const Int_t TGo4TaskManager::fgiDISCONCYCLES =360
static

cycles to wait for client disconnection

Definition at line 127 of file TGo4TaskManager.h.

Referenced by WaitForClientRemoved().

◆ fguDISCONTIME

const UInt_t TGo4TaskManager::fguDISCONTIME =500
static

time for each disonnection wait cycle

Definition at line 132 of file TGo4TaskManager.h.

Referenced by WaitForClientRemoved().

◆ fuNegotiationPort

UInt_t TGo4TaskManager::fuNegotiationPort {0}
private

port number for the server client negotiation connections

Definition at line 156 of file TGo4TaskManager.h.

Referenced by TGo4TaskManager(), GetNegotiationPort(), and ServeClient().

◆ fuTaskCount

UInt_t TGo4TaskManager::fuTaskCount {0}
private

Definition at line 153 of file TGo4TaskManager.h.

Referenced by TGo4TaskManager(), AddClient(), DisConnectClient(), and GetTaskCount().

◆ fxListMutex

TMutex* TGo4TaskManager::fxListMutex {nullptr}
private

◆ fxServer

TGo4ServerTask* TGo4TaskManager::fxServer {nullptr}
private

◆ fxTaskIter

TIterator* TGo4TaskManager::fxTaskIter {nullptr}
private

Iterator over list of tasks.

Definition at line 151 of file TGo4TaskManager.h.

Referenced by TGo4TaskManager(), ~TGo4TaskManager(), and NextTaskHandler().

◆ fxTaskList

TObjArray* TGo4TaskManager::fxTaskList {nullptr}
private

◆ fxTransport

TGo4Socket* TGo4TaskManager::fxTransport {nullptr}
private

The documentation for this class was generated from the following files: