ATLAS Offline Software
TrigRDBManager.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef TRIGSERVICES_TRIGRDBMANAGER_H
5 #define TRIGSERVICES_TRIGRDBMANAGER_H
6 
7 // Athena/Gaudi includes
8 #include "GaudiKernel/ServiceHandle.h"
10 
11 // CORAL includes
12 #include "CoralKernel/Context.h"
13 #include "RelationalAccess/IConnectionService.h"
14 
22 public:
28  static StatusCode closeDBConnections(MsgStream& msg)
29  {
30  // Cleanup of dangling database connections from RDBAccessSvc
31  ServiceHandle<IRDBAccessSvc> rdbAccessSvc("RDBAccessSvc", "TrigRDBManager");
32  if (rdbAccessSvc->shutdown("*Everything*")) {
33  msg << MSG::INFO << "Cleaning up RDBAccessSvc connections" << endmsg;
34  }
35  else {
36  msg << MSG::ERROR << "Cleaning up RDBAccessSvc connections failed" << endmsg;
37  return StatusCode::FAILURE;
38  }
39 
40  // Instantiate connection service
41  coral::Context& context = coral::Context::instance();
42  // Load CORAL connection service
43  coral::IHandle<coral::IConnectionService> connSvcH = context.query<coral::IConnectionService>();
44  if (connSvcH.isValid()) {
45  msg << MSG::INFO << "Cleaning up idle CORAL connections" << endmsg;
46  connSvcH->purgeConnectionPool();
47  }
48  return StatusCode::SUCCESS;
49  }
50 };
51 
52 #endif
TrigRDBManager
Helper to manage database connections.
Definition: TrigRDBManager.h:21
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrigRDBManager::closeDBConnections
static StatusCode closeDBConnections(MsgStream &msg)
Close database connections.
Definition: TrigRDBManager.h:28
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
ServiceHandle< IRDBAccessSvc >