Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes

TGo4TaskManager Class Reference

#include <TGo4TaskManager.h>

List of all members.

Public Member Functions

 TGo4TaskManager (const char *name, TGo4ServerTask *server, UInt_t negotiationport=0, Bool_t createconnector=kTRUE)
virtual ~TGo4TaskManager ()
Int_t ServeClient ()
Go4CommandMode_t ClientLogin ()
Int_t ConnectClient (const char *client, const char *host, Go4CommandMode_t role=kGo4ComModeController)
Int_t DisConnectClient (const char *name, Bool_t clientwait=kTRUE)
Int_t DisConnectClient (TGo4TaskHandler *taskhandler, Bool_t clientwait=kTRUE)
Bool_t AddClient (const char *client, const char *host, Go4CommandMode_t role)
Bool_t AddTaskHandler (TGo4TaskHandler *han)
TGo4TaskHandlerNewTaskHandler (const char *name)
Bool_t RemoveTaskHandler (const char *name)
TGo4TaskHandlerGetTaskHandler (const char *name)
TGo4TaskHandlerGetLastTaskHandler ()
TGo4TaskHandlerNextTaskHandler (Bool_t reset=kFALSE)
TMutex * GetMutex ()
UInt_t GetTaskCount () const
UInt_t GetNegotiationPort ()
Int_t WaitForClientRemoved ()
Bool_t HasControllerTask ()

Static Public Attributes

static const Int_t fgiDISCONCYCLES = 360
static const UInt_t fguDISCONTIME = 500

Private Member Functions

 TGo4TaskManager ()
 TGo4TaskManager (const TGo4TaskManager &right)

Private Attributes

TGo4ServerTaskfxServer
TGo4SocketfxTransport
TObjArray * fxTaskList
TMutex * fxListMutex
TIterator * fxTaskIter
UInt_t fuTaskCount
UInt_t fuNegotiationPort
Bool_t fbClientIsRemoved
Bool_t fbHasControllerConnection

Detailed Description

Definition at line 27 of file TGo4TaskManager.h.


Constructor & Destructor Documentation

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

Definition at line 68 of file TGo4TaskManager.cxx.

References TGo4Socket::Close(), fxListMutex, fxTaskIter, fxTaskList, and fxTransport.

TGo4TaskManager::TGo4TaskManager (  )  [private]
TGo4TaskManager::TGo4TaskManager ( const TGo4TaskManager right  )  [private]

Member Function Documentation

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

adds external task handler to array

Definition at line 403 of file TGo4TaskManager.cxx.

References fxListMutex, and fxTaskList.

Referenced by NewTaskHandler().

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 208 of file TGo4TaskManager.cxx.

References TGo4Log::Debug(), fbHasControllerConnection, TGo4TaskHandler::fgcMASTER, TGo4TaskHandler::fgcSLAVE, TGo4TaskHandler::fgxADMINISTRATORACCOUNT, TGo4TaskHandler::fgxCONTROLLERACCOUNT, TGo4TaskHandler::fgxOBSERVERACCOUNT, fxServer, fxTransport, TGo4TaskHandler::Get_fgcOK(), TGo4Task::IsMaster(), TGo4Socket::RecvRaw(), and TGo4Log::Warn().

Referenced by ServeClient().

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 299 of file TGo4TaskManager.cxx.

References AddClient().

Referenced by ServeClient().

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 309 of file TGo4TaskManager.cxx.

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

Referenced by TGo4ServerTask::RemoveClient(), and ServeClient().

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

returns last task handler in list

Definition at line 490 of file TGo4TaskManager.cxx.

References fxListMutex, and fxTaskList.

Referenced by TGo4ServerTask::SetCurrentTask().

TMutex* TGo4TaskManager::GetMutex (  )  [inline]
UInt_t TGo4TaskManager::GetNegotiationPort (  ) 

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

Definition at line 534 of file TGo4TaskManager.cxx.

References fuNegotiationPort, fxTransport, and TGo4Socket::GetPort().

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

UInt_t TGo4TaskManager::GetTaskCount (  )  const [inline]

Number of entries in taskhandler list, i.e. number of connected clients

Definition at line 106 of file TGo4TaskManager.h.

References fuTaskCount.

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

returns certain task handler by name

Definition at line 480 of file TGo4TaskManager.cxx.

References fxListMutex, and fxTaskList.

Referenced by DisConnectClient(), TGo4ServerTask::GetTaskHandler(), and TGo4ServerTask::SetCurrentTask().

Bool_t TGo4TaskManager::HasControllerTask (  )  [inline]

Definition at line 118 of file TGo4TaskManager.h.

References fbHasControllerConnection.

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

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

Definition at line 425 of file TGo4TaskManager.cxx.

References AddTaskHandler(), fxServer, TGo4Task::IsMaster(), and TGo4TaskHandler::TGo4TaskHandler().

Referenced by AddClient().

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 500 of file TGo4TaskManager.cxx.

References fxListMutex, and fxTaskIter.

Referenced by TGo4ServerTask::NextCommand(), TGo4ServerTask::RemoveAllClients(), TGo4ServerTask::SendStatus(), and TGo4ServerTask::SendStatusBuffer().

Bool_t TGo4TaskManager::RemoveTaskHandler ( const char *  name  ) 

removes task handler from array by name

Definition at line 443 of file TGo4TaskManager.cxx.

References fxListMutex, fxServer, fxTaskList, TGo4ServerTask::GetCurrentTaskHandler(), TGo4ServerTask::SetCurrentTask(), and TGo4Task::StartWorkThreads().

Referenced by AddClient(), and DisConnectClient().

Int_t TGo4TaskManager::ServeClient (  ) 
Int_t TGo4TaskManager::WaitForClientRemoved (  ) 

Member Data Documentation

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 169 of file TGo4TaskManager.h.

Referenced by DisConnectClient(), and WaitForClientRemoved().

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 174 of file TGo4TaskManager.h.

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

const Int_t TGo4TaskManager::fgiDISCONCYCLES = 360 [static]

cycles to wait for client disconnection

Definition at line 123 of file TGo4TaskManager.h.

Referenced by WaitForClientRemoved().

const UInt_t TGo4TaskManager::fguDISCONTIME = 500 [static]

time for each disonnection wait cycle

Definition at line 128 of file TGo4TaskManager.h.

Referenced by WaitForClientRemoved().

port number for the server client negotiation connections

Definition at line 162 of file TGo4TaskManager.h.

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

UInt_t TGo4TaskManager::fuTaskCount [private]

1..* 1 TObjArray

Definition at line 157 of file TGo4TaskManager.h.

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

TMutex* TGo4TaskManager::fxListMutex [private]
TIterator* TGo4TaskManager::fxTaskIter [private]

Iterator over list of tasks.

Definition at line 149 of file TGo4TaskManager.h.

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

TObjArray* TGo4TaskManager::fxTaskList [private]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines