ATLAS Offline Software
Loading...
Searching...
No Matches
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
22public:
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
#define endmsg
Definition of the abstract IRDBAccessSvc interface.
Helper to manage database connections.
static StatusCode closeDBConnections(MsgStream &msg)
Close database connections.
MsgStream & msg
Definition testRead.cxx:32