Skip to content

Commit

Permalink
Use thread-safe xerces-c initialization / termination helpers.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktf committed Oct 2, 2013
1 parent 4e22899 commit 242eb21
Show file tree
Hide file tree
Showing 89 changed files with 221 additions and 207 deletions.
1 change: 1 addition & 0 deletions Alignment/MuonAlignment/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<use name="Geometry/Records"/>
<use name="DataFormats/DetId"/>
<use name="FWCore/Framework"/>
<use name="FWCore/Concurrency"/>
<use name="CondCore/DBCommon"/>
<use name="CondCore/DBOutputService"/>
<use name="CondFormats/Alignment"/>
Expand Down
5 changes: 3 additions & 2 deletions Alignment/MuonAlignment/src/MuonAlignmentInputXML.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

// system include files
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Concurrency/interface/Xerces.h"

// Xerces include files
#include "xercesc/parsers/XercesDOMParser.hpp"
Expand Down Expand Up @@ -257,7 +258,7 @@ AlignableMuon *MuonAlignmentInputXML::newAlignableMuon(const edm::EventSetup& iS
recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->CSCEndcaps());

try {
XMLPlatformUtils::Initialize();
cms::concurrency::xercesInitialize();
}
catch (const XMLException &toCatch) {
throw cms::Exception("XMLException") << "Xerces XML parser threw an exception on initialization." << std::endl;
Expand Down Expand Up @@ -431,7 +432,7 @@ AlignableMuon *MuonAlignmentInputXML::newAlignableMuon(const edm::EventSetup& iS
delete parser;
delete errHandler;

XMLPlatformUtils::Terminate();
cms::concurrency::xercesTerminate();

delete ideal_alignableMuon;
return alignableMuon;
Expand Down
1 change: 1 addition & 0 deletions CalibCalorimetry/CaloMiscalibTools/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<use name="FWCore/Framework"/>
<use name="FWCore/PluginManager"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/Concurrency"/>
<use name="CondFormats/DataRecord"/>
<use name="DataFormats/EcalDetId"/>
<use name="DataFormats/HcalDetId"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMCharacterData.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "FWCore/Concurrency/interface/Xerces.h"
#include <xercesc/framework/LocalFileFormatTarget.hpp>
#include <xercesc/util/XMLUni.hpp>
#include <xercesc/util/XMLURL.hpp>
Expand Down
3 changes: 2 additions & 1 deletion CalibCalorimetry/CaloMiscalibTools/src/MiscalibReaderXML.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXML.h"
#include "CalibCalorimetry/CaloMiscalibTools/interface/MiscalibReaderFromXMLDomUtils.h"
#include "CalibCalorimetry/CaloMiscalibTools/interface/CaloMiscalibMap.h"
#include "FWCore/Concurrency/interface/Xerces.h"
#include <stdio.h>
#include <stdlib.h>
#include <string>
Expand Down Expand Up @@ -29,7 +30,7 @@ MiscalibReaderFromXML::MiscalibReaderFromXML(CaloMiscalibMap & caloMap):caloMap_
//std::cout << "Xerces-c initialization Number "
//<< s_numberOfInstances<<std::endl;
if (s_numberOfInstances==0)
XMLPlatformUtils::Initialize();
cms::concurrency::xercesInitialize();
}
catch (const XMLException& e) {
std::cout << "Xerces-c error in initialization \n"
Expand Down
1 change: 1 addition & 0 deletions CalibCalorimetry/HcalTPGAlgos/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<use name="CalibCalorimetry/HcalAlgos"/>
<use name="DataFormats/DetId"/>
<use name="DataFormats/HcalDetId"/>
<use name="FWCore/Concurrency"/>
<use name="CondFormats/HcalObjects"/>
<use name="CalibFormats/CaloObjects"/>
<use name="CondFormats/DataRecord"/>
Expand Down
2 changes: 1 addition & 1 deletion CalibCalorimetry/HcalTPGAlgos/interface/XMLProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <time.h>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "FWCore/Concurrency/interface/Xerces.h"
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/framework/MemBufInputSource.hpp>
#include <cstdio>
Expand Down
6 changes: 3 additions & 3 deletions CalibCalorimetry/HcalTPGAlgos/src/XMLProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <xercesc/dom/DOM.hpp>
#include <xercesc/sax/HandlerBase.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "FWCore/Concurrency/interface/Xerces.h"
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/framework/StdOutFormatTarget.hpp>
#include <xercesc/framework/LocalFileFormatTarget.hpp>
Expand Down Expand Up @@ -299,7 +299,7 @@ int XMLProcessor::init( void )
{
std::cerr << "Intializing Xerces-c...";
try {
XMLPlatformUtils::Initialize();
cms::concurrency::xercesInitialize();
//
//_____ following removed as a xalan-c component_____________________
//
Expand All @@ -324,7 +324,7 @@ int XMLProcessor::terminate( void )
//std::cout << " done" << std::endl;

std::cout << "Terminating Xerces-c...";
XMLPlatformUtils::Terminate();
cms::concurrency::xercesTerminate();
std::cout << " done" << std::endl;


Expand Down
1 change: 1 addition & 0 deletions Calibration/HcalCalibAlgos/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<use name="FWCore/PluginManager"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/Utilities"/>
<use name="FWCore/Concurrency"/>
<use name="CommonTools/UtilAlgos"/>
<use name="DataFormats/EcalDetId"/>
<use name="DataFormats/HcalDetId"/>
Expand Down
2 changes: 1 addition & 1 deletion Calibration/HcalCalibAlgos/src/HcalConstantsXMLWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMCharacterData.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "FWCore/Concurrency/interface/Xerces.h"
#include <xercesc/framework/LocalFileFormatTarget.hpp>
#include <xercesc/util/XMLUni.hpp>
#include <xercesc/util/XMLURL.hpp>
Expand Down
1 change: 1 addition & 0 deletions CondCore/DBCommon/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<use name="CoralKernel"/>
<use name="RelationalAccess"/>
<use name="FWCore/Framework"/>
<use name="FWCore/Concurrency"/>
<use name="CondCore/ORA"/>
<export>
<lib name="1"/>
Expand Down
1 change: 1 addition & 0 deletions CondCore/DBCommon/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<use name="FWCore/PluginManager"/>
<use name="FWCore/Concurrency"/>
<use name="CondCore/DBCommon"/>
<use name="rootcintex"/>
<use name="zlib"/>
Expand Down
5 changes: 3 additions & 2 deletions CondCore/DBCommon/plugins/XMLAuthenticationService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "CoralKernel/Property.h"
#include "CoralKernel/Context.h"
#include "CondCore/DBCommon/interface/CoralServiceMacros.h"
#include "FWCore/Concurrency/interface/Xerces.h"
#include "xercesc/parsers/XercesDOMParser.hpp"
#include "xercesc/framework/MemBufInputSource.hpp"
#include "xercesc/dom/DOM.hpp"
Expand Down Expand Up @@ -345,7 +346,7 @@ cond::XMLAuthenticationService::XMLAuthenticationService::initialize()

try
{
xercesc::XMLPlatformUtils::Initialize();
cms::concurrency::xercesInitialize();
}
catch ( const xercesc::XMLException& toCatch )
{
Expand All @@ -365,7 +366,7 @@ cond::XMLAuthenticationService::XMLAuthenticationService::initialize()
}
}

xercesc::XMLPlatformUtils::Terminate();
cms::concurrency::xercesTerminate();

m_isInitialized = result;
if(!m_isInitialized) reset();
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<use name="FWCore/PluginManager"/>
<use name="FWCore/MessageLogger"/>
<use name="FWCore/Framework"/>
<use name="FWCore/Concurrency"/>
<use name="boost"/>
<use name="boost_program_options"/>
<use name="CondCore/ORA"/>
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/bin/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<use name="CondCore/Utilities"/>
<use name="FWCore/Concurrency"/>
<flags CXXFLAGS="-Wno-sign-compare -Wno-unused-variable -ftemplate-depth=600"/>

<bin file="cmscond_list_iov.cpp" name="cmscond_list_iov">
Expand Down
5 changes: 3 additions & 2 deletions CondCore/Utilities/bin/cmscond_authentication_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "CondCore/Utilities/interface/Utilities.h"
//
#include "RelationalAccess/AuthenticationCredentials.h"
#include "FWCore/Concurrency/interface/Xerces.h"
//
#include <iostream>
#include <fstream>
Expand Down Expand Up @@ -405,7 +406,7 @@ bool coral_bridge::parseXMLAuthenticationFile( const std::string& inputFileName,
AuthenticationCredentialSet& data){
try
{
xercesc::XMLPlatformUtils::Initialize();
cms::concurrency::xercesInitialize();
}
catch ( const xercesc::XMLException& toCatch )
{
Expand Down Expand Up @@ -543,7 +544,7 @@ bool coral_bridge::parseXMLAuthenticationFile( const std::string& inputFileName,
result = false;
}

xercesc::XMLPlatformUtils::Terminate();
cms::concurrency::xercesTerminate();

return result;
}
Expand Down
1 change: 1 addition & 0 deletions CondTools/Ecal/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<use name="FWCore/ParameterSet"/>
<use name="FWCore/PluginManager"/>
<use name="FWCore/ServiceRegistry"/>
<use name="FWCore/Concurrency"/>
<use name="OnlineDB/EcalCondDB"/>
<use name="OnlineDB/Oracle"/>
<use name="SimCalorimetry/EcalSelectiveReadoutProducers"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "FWCore/Concurrency/interface/Xerces.h"
#include <xercesc/util/XMLString.hpp>
#include <xercesc/sax/SAXException.hpp>
#include <xercesc/framework/LocalFileFormatTarget.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "FWCore/Concurrency/interface/Xerces.h"
#include <xercesc/util/XMLString.hpp>
#include <xercesc/sax/SAXException.hpp>
#include <xercesc/framework/LocalFileFormatTarget.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "FWCore/Concurrency/interface/Xerces.h"
#include <xercesc/util/XMLString.hpp>
#include <xercesc/sax/SAXException.hpp>
#include <xercesc/framework/LocalFileFormatTarget.hpp>
Expand Down
6 changes: 3 additions & 3 deletions CondTools/Ecal/src/DOMHelperFunctions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "FWCore/Concurrency/interface/Xerces.h"
#include <xercesc/framework/LocalFileFormatTarget.hpp>
#include <sstream>

Expand Down Expand Up @@ -214,7 +214,7 @@ void xuti::readHeader(xercesc::DOMNode* parentNode,

int xuti::readHeader(const std::string& filename,EcalCondHeader& header ){

XMLPlatformUtils::Initialize();
cms::concurrency::xercesInitialize();

XercesDOMParser* parser = new XercesDOMParser;
parser->setValidationScheme( XercesDOMParser::Val_Never );
Expand All @@ -236,7 +236,7 @@ int xuti::readHeader(const std::string& filename,EcalCondHeader& header ){
xuti::readHeader(elementRoot, header);

delete parser;
XMLPlatformUtils::Terminate();
cms::concurrency::xercesTerminate();

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions CondTools/Ecal/src/ESGainXMLTranslator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "FWCore/Concurrency/interface/Xerces.h"
#include <xercesc/util/XMLString.hpp>
#include <xercesc/sax/SAXException.hpp>
#include <xercesc/framework/LocalFileFormatTarget.hpp>
Expand All @@ -30,7 +30,7 @@ int ESGainXMLTranslator::writeXML(const std::string& filename,
std::string ESGainXMLTranslator::dumpXML(const EcalCondHeader& header,
const ESGain& record){

XMLPlatformUtils::Initialize();
cms::concurrency::xercesInitialize();

DOMImplementation* impl =
DOMImplementationRegistry::getDOMImplementation(fromNative("LS").c_str());
Expand All @@ -56,7 +56,7 @@ std::string ESGainXMLTranslator::dumpXML(const EcalCondHeader& header,
std::string dump= toNative(writer->writeToString(*root));
doc->release();

// XMLPlatformUtils::Terminate();
// cms::concurrency::xercesTerminate();

return dump;
}
Expand Down
10 changes: 5 additions & 5 deletions CondTools/Ecal/src/EcalADCToGeVXMLTranslator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "FWCore/Concurrency/interface/Xerces.h"
#include <xercesc/util/XMLString.hpp>
#include <xercesc/sax/SAXException.hpp>
#include <xercesc/framework/LocalFileFormatTarget.hpp>
Expand All @@ -25,7 +25,7 @@ int EcalADCToGeVXMLTranslator::readXML(const std::string& filename,
EcalADCToGeVConstant& record){


XMLPlatformUtils::Initialize();
cms::concurrency::xercesInitialize();

XercesDOMParser* parser = new XercesDOMParser;
parser->setValidationScheme( XercesDOMParser::Val_Never );
Expand Down Expand Up @@ -60,7 +60,7 @@ int EcalADCToGeVXMLTranslator::readXML(const std::string& filename,


delete parser;
XMLPlatformUtils::Terminate();
cms::concurrency::xercesTerminate();
return 0;

}
Expand All @@ -81,7 +81,7 @@ int EcalADCToGeVXMLTranslator::writeXML(const std::string& filename,
std::string EcalADCToGeVXMLTranslator::dumpXML(const EcalCondHeader& header,
const EcalADCToGeVConstant& record){

XMLPlatformUtils::Initialize();
cms::concurrency::xercesInitialize();

DOMImplementation* impl =
DOMImplementationRegistry::getDOMImplementation(fromNative("LS").c_str());
Expand All @@ -108,7 +108,7 @@ std::string EcalADCToGeVXMLTranslator::dumpXML(const EcalCondHeader& header,
std::string dump= toNative(writer->writeToString(*root));
doc->release();

// XMLPlatformUtils::Terminate();
// cms::concurrency::xercesTerminate();

return dump;
}
Expand Down
4 changes: 2 additions & 2 deletions CondTools/Ecal/src/EcalAlignmentXMLTranslator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "FWCore/Concurrency/interface/Xerces.h"
#include <xercesc/util/XMLString.hpp>
#include <xercesc/sax/SAXException.hpp>
#include <xercesc/framework/LocalFileFormatTarget.hpp>
Expand All @@ -28,7 +28,7 @@ int EcalAlignmentXMLTranslator::writeXML(const string& filename,
string EcalAlignmentXMLTranslator::dumpXML(const EcalCondHeader& header,
const Alignments& record){

XMLPlatformUtils::Initialize();
cms::concurrency::xercesInitialize();

DOMImplementation* impl =
DOMImplementationRegistry::getDOMImplementation(fromNative("LS").c_str());
Expand Down
Loading

0 comments on commit 242eb21

Please sign in to comment.