ATLAS Offline Software
|
This athena service will create an ONC/RPC (aka SunRPC) server, that can provide the athena status as well as data strings from events. More...
#include <ONCRPCServerSvc.h>
Public Member Functions | |
ONCRPCServerSvc (const std::string &name, ISvcLocator *sl) | |
Default constructor. More... | |
virtual | ~ONCRPCServerSvc () |
Destructor. More... | |
virtual StatusCode | initialize () override |
Gaudi default methods. More... | |
virtual StatusCode | finalize () override |
Finalize - called once at the end. More... | |
Server methods | |
int | m_portNumber |
EventStreamMap | m_eventStreamMap |
pthread_mutex_t m_accessLock | ATLAS_THREAD_SAFE |
pthread_t | m_ServerThreadHandle |
bool | m_runServerThread |
virtual int | GetState () const override |
get the Status of the application More... | |
virtual std::vector< std::string > | GetStreamNames () const override |
get the names of all the streams More... | |
virtual const EventStreamID | GetEventStreamID (const std::string &streamName) const override |
get the current EventStreamID for a particular stream More... | |
virtual const std::string | GetEvent (const EventStreamID &evtStreamID) const override |
get the current event for a particular stream More... | |
virtual StatusCode | UpdateEventForStream (const EventStreamID &evtStreamID, const std::string &event) override |
Put this event as new current event for stream given by name. More... | |
virtual void | Message (const MSG::Level level, const std::string &mesg) const override |
This function is exposed to allow using athena messaging service from other threads. More... | |
virtual MSG::Level | LogLevel () const override |
Get the logging level. More... | |
virtual bool | GetRunServerFlag () const override |
The server thread will stop once this flag is set to false. More... | |
StatusCode | StartServer () |
Start the server thread. More... | |
StatusCode | StopServer () |
Stop the server thread. More... | |
virtual void | ServerThreadStopped () override |
Callback when server thread terminates. More... | |
This athena service will create an ONC/RPC (aka SunRPC) server, that can provide the athena status as well as data strings from events.
It can handle several different event streams, but for each stream only the latest event is available. This service is usually used by the Athena JiveXML algorithm providing XML events for an Atlantis Java client.
The server will create a single server thread, which loops over the sockets until the m_runServerThread flag is set to false. On each request, it will call the ONCRPCRequestHandler, which will generate a new thread for each request. The actual response to the requests happens in these ONCRPCDispatchThread. A list of the thread handles is kept in the a ThreadCollection, where each thread will add and remove itself. In the finalization stage, the server will wait for all dispatch threats to finish before exiting.
On all stages, the server thread will have a handle to the athena service via the thread specific key ServerSvcKey. It is thus possible to have many servers running simultaneously. Note however, that currently RPC will forbid you to start several servers with the same ONCRPCSERVERPROG.
Definition at line 42 of file ONCRPCServerSvc.h.
JiveXML::ONCRPCServerSvc::ONCRPCServerSvc | ( | const std::string & | name, |
ISvcLocator * | sl | ||
) |
Default constructor.
Constructor.
Definition at line 268 of file ONCRPCServerSvc.cxx.
|
virtual |
Destructor.
Definition at line 284 of file ONCRPCServerSvc.cxx.
|
overridevirtual |
Finalize - called once at the end.
Definition at line 314 of file ONCRPCServerSvc.cxx.
|
overridevirtual |
get the current event for a particular stream
Return the event for a given stream.
Implements JiveXML::IEventServer.
Definition at line 241 of file ONCRPCServerSvc.cxx.
|
overridevirtual |
get the current EventStreamID for a particular stream
Return the EventStreamID for the last event of a given stream.
Implements JiveXML::IEventServer.
Definition at line 214 of file ONCRPCServerSvc.cxx.
|
inlineoverridevirtual |
The server thread will stop once this flag is set to false.
Implements JiveXML::IEventServer.
Definition at line 82 of file ONCRPCServerSvc.h.
|
overridevirtual |
get the Status of the application
Return the current athena state.
at the moment simply return state machine state - we might consider checking for state transitions (m_state != m_targetState) and return a "busy" value. At the moment, all state transitions should be instantanious, so this is not necessary
Implements JiveXML::IEventServer.
Definition at line 166 of file ONCRPCServerSvc.cxx.
|
overridevirtual |
get the names of all the streams
Return an array with all the stream names.
Implements JiveXML::IEventServer.
Definition at line 179 of file ONCRPCServerSvc.cxx.
|
overridevirtual |
Gaudi default methods.
Initialize - called once in beginning.
Create the server itself
Definition at line 293 of file ONCRPCServerSvc.cxx.
|
overridevirtual |
Get the logging level.
Return the logging level - possibly to detect whether it is worth retrieving the information to be logged.
Implements JiveXML::IMessage.
Definition at line 157 of file ONCRPCServerSvc.cxx.
|
overridevirtual |
This function is exposed to allow using athena messaging service from other threads.
Deliver a message - possibly from another thread - to the athena msgSvc;.
Implements JiveXML::IMessage.
Definition at line 144 of file ONCRPCServerSvc.cxx.
|
overridevirtual |
Callback when server thread terminates.
This callback will get called whenever the server thread stops.
Implements JiveXML::IServer.
Definition at line 130 of file ONCRPCServerSvc.cxx.
StatusCode JiveXML::ONCRPCServerSvc::StartServer | ( | ) |
Start the server thread.
Create the server by.
Definition at line 33 of file ONCRPCServerSvc.cxx.
StatusCode JiveXML::ONCRPCServerSvc::StopServer | ( | ) |
Stop the server thread.
Stop the server by.
Ping the server which will cause another request Otherwise the server won't update its loop condition
Definition at line 68 of file ONCRPCServerSvc.cxx.
|
overridevirtual |
Put this event as new current event for stream given by name.
Implementation of IServerSvc method.
Get one event and put it as the new event for the this stream, which is identified by EventStreamID
Implements JiveXML::IEventReceiver.
Definition at line 326 of file ONCRPCServerSvc.cxx.
|
mutableprivate |
Definition at line 100 of file ONCRPCServerSvc.h.
|
private |
Definition at line 97 of file ONCRPCServerSvc.h.
|
private |
Definition at line 94 of file ONCRPCServerSvc.h.
|
private |
Definition at line 107 of file ONCRPCServerSvc.h.
|
private |
Definition at line 103 of file ONCRPCServerSvc.h.