ATLAS Offline Software
ONCRPCServerSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef JIVEXML_ONCRPCSERVERSVC_H
6 #define JIVEXML_ONCRPCSERVERSVC_H
7 
10 #include "GaudiKernel/ServiceHandle.h"
11 #include "GaudiKernel/MsgStream.h"
12 #include "JiveXML/EventStream.h"
13 #include "JiveXML/IServerSvc.h"
14 #include "JiveXML/IServer.h"
15 
16 namespace JiveXML {
17 
18  //forward declarations
19  class ThreadCollection;
20 
42  class ONCRPCServerSvc : public extends<AthService, IServerSvc>,
43  virtual public IServer {
44  public:
45 
47  ONCRPCServerSvc(const std::string& name, ISvcLocator* sl);
49  virtual ~ONCRPCServerSvc();
50 
52  virtual StatusCode initialize() override;
53  virtual StatusCode finalize() override;
54 
55 
59  virtual int GetState() const override;
61  virtual std::vector<std::string> GetStreamNames() const override;
63  virtual const EventStreamID GetEventStreamID(const std::string& streamName) const override;
65  virtual
66  const std::string GetEvent( const EventStreamID& evtStreamID ) const override;
68  virtual StatusCode UpdateEventForStream( const EventStreamID& evtStreamID, const std::string & event) override;
70 
75  virtual
76  void Message( const MSG::Level level, const std::string& mesg ) const override;
78  virtual MSG::Level LogLevel() const override;
79 
80 
82  virtual bool GetRunServerFlag () const override { return m_runServerThread; };
88  virtual void ServerThreadStopped() override;
89 
90  private:
91 
92  //Port number property - defaults to zero in which case
93  //it is dynamically assigned
95 
96  //A map of the streams and their current events
98 
99  //A mutex (mutual exclusive) lock for the data map
100  mutable pthread_mutex_t m_accessLock ATLAS_THREAD_SAFE;
101 
102  //A handle to the server thread
104 
105  //Once this flag is set to false, the thread will stop after handling its
106  //last request
108  };
109 
110 } //namespace
111 
112 #endif
113 
JiveXML::ONCRPCServerSvc::m_ServerThreadHandle
pthread_t m_ServerThreadHandle
Definition: ONCRPCServerSvc.h:103
JiveXML::ONCRPCServerSvc::GetEvent
virtual const std::string GetEvent(const EventStreamID &evtStreamID) const override
get the current event for a particular stream
Definition: ONCRPCServerSvc.cxx:241
JiveXML::EventStreamMap
std::map< const EventStreamID, const std::string > EventStreamMap
Definition: EventStream.h:87
JiveXML::ONCRPCServerSvc::ServerThreadStopped
virtual void ServerThreadStopped() override
Callback when server thread terminates.
Definition: ONCRPCServerSvc.cxx:130
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
JiveXML::ONCRPCServerSvc::GetRunServerFlag
virtual bool GetRunServerFlag() const override
The server thread will stop once this flag is set to false.
Definition: ONCRPCServerSvc.h:82
JiveXML::ONCRPCServerSvc::GetStreamNames
virtual std::vector< std::string > GetStreamNames() const override
get the names of all the streams
Definition: ONCRPCServerSvc.cxx:179
JiveXML::ONCRPCServerSvc::ONCRPCServerSvc
ONCRPCServerSvc(const std::string &name, ISvcLocator *sl)
Default constructor.
Definition: ONCRPCServerSvc.cxx:268
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
IServerSvc.h
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
JiveXML::ONCRPCServerSvc::finalize
virtual StatusCode finalize() override
Finalize - called once at the end.
Definition: ONCRPCServerSvc.cxx:314
JiveXML::ONCRPCServerSvc::StartServer
StatusCode StartServer()
Start the server thread.
Definition: ONCRPCServerSvc.cxx:33
JiveXML::EventStreamID
For the client-server communication, each event is uniquely identified by the run number,...
Definition: EventStream.h:19
JiveXML
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
Definition: BadLArRetriever.cxx:22
JiveXML::ONCRPCServerSvc::GetState
virtual int GetState() const override
get the Status of the application
Definition: ONCRPCServerSvc.cxx:166
JiveXML::ONCRPCServerSvc::Message
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.
Definition: ONCRPCServerSvc.cxx:144
JiveXML::ONCRPCServerSvc::m_eventStreamMap
EventStreamMap m_eventStreamMap
Definition: ONCRPCServerSvc.h:97
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
JiveXML::ONCRPCServerSvc::m_runServerThread
bool m_runServerThread
Definition: ONCRPCServerSvc.h:107
JiveXML::ONCRPCServerSvc::initialize
virtual StatusCode initialize() override
Gaudi default methods.
Definition: ONCRPCServerSvc.cxx:293
IServer.h
JiveXML::ONCRPCServerSvc::StopServer
StatusCode StopServer()
Stop the server thread.
Definition: ONCRPCServerSvc.cxx:68
JiveXML::IServer
Pure abstract interface for all full server implementations.
Definition: IServer.h:22
AthenaPoolExample_Copy.streamName
string streamName
Definition: AthenaPoolExample_Copy.py:39
JiveXML::ONCRPCServerSvc::ATLAS_THREAD_SAFE
pthread_mutex_t m_accessLock ATLAS_THREAD_SAFE
Definition: ONCRPCServerSvc.h:100
JiveXML::ONCRPCServerSvc::~ONCRPCServerSvc
virtual ~ONCRPCServerSvc()
Destructor.
Definition: ONCRPCServerSvc.cxx:284
JiveXML::ONCRPCServerSvc::GetEventStreamID
virtual const EventStreamID GetEventStreamID(const std::string &streamName) const override
get the current EventStreamID for a particular stream
Definition: ONCRPCServerSvc.cxx:214
AthService.h
JiveXML::ONCRPCServerSvc::UpdateEventForStream
virtual StatusCode UpdateEventForStream(const EventStreamID &evtStreamID, const std::string &event) override
Put this event as new current event for stream given by name.
Definition: ONCRPCServerSvc.cxx:326
JiveXML::ONCRPCServerSvc
This athena service will create an ONC/RPC (aka SunRPC) server, that can provide the athena status as...
Definition: ONCRPCServerSvc.h:43
JiveXML::ONCRPCServerSvc::LogLevel
virtual MSG::Level LogLevel() const override
Get the logging level.
Definition: ONCRPCServerSvc.cxx:157
checker_macros.h
Define macros for attributes used to control the static checker.
EventStream.h
JiveXML::ONCRPCServerSvc::m_portNumber
int m_portNumber
Definition: ONCRPCServerSvc.h:94