From cd3166280e53b8587d4d257b7898577b65edc0b7 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 20 Jan 2010 17:07:54 +0000 Subject: Cluster-safe assertions. Assert that replicated data structures are modified in a cluster-safe context - in cluster delivery thread or during update. Assertions added to Queue.cpp and SemanticState.cpp. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@901282 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/cluster/Cluster.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cpp/src/qpid/cluster') diff --git a/cpp/src/qpid/cluster/Cluster.cpp b/cpp/src/qpid/cluster/Cluster.cpp index cc245d2f3f..53100fa0c1 100644 --- a/cpp/src/qpid/cluster/Cluster.cpp +++ b/cpp/src/qpid/cluster/Cluster.cpp @@ -105,6 +105,7 @@ */ #include "qpid/Exception.h" #include "qpid/cluster/Cluster.h" +#include "qpid/sys/ClusterSafe.h" #include "qpid/cluster/ClusterSettings.h" #include "qpid/cluster/Connection.h" #include "qpid/cluster/UpdateClient.h" @@ -152,6 +153,7 @@ #include #include + namespace qpid { namespace cluster { using namespace qpid; @@ -357,6 +359,7 @@ void Cluster::leave(Lock&) { state = LEFT; QPID_LOG(notice, *this << " leaving cluster " << name); // Finalize connections now now to avoid problems later in destructor. + ClusterSafeScope css; // Don't trigger cluster-safe assertions. LEAVE_TRY(localConnections.clear()); LEAVE_TRY(connections.clear()); LEAVE_TRY(broker::SignalHandler::shutdown()); @@ -440,6 +443,7 @@ void Cluster::flagError( // Handler for deliverFrameQueue. // This thread executes the main logic. void Cluster::deliveredFrame(const EventFrame& efConst) { + sys::ClusterSafeScope css; // Don't trigger cluster-safe asserts. Mutex::ScopedLock l(lock); if (state == LEFT) return; EventFrame e(efConst); @@ -560,6 +564,7 @@ void Cluster::setReady(Lock&) { if (mgmtObject!=0) mgmtObject->set_status("ACTIVE"); mcast.setReady(); broker.getQueueEvents().enable(); + enableClusterSafe(); // Enable cluster-safe assertions. } void Cluster::initMapCompleted(Lock& l) { @@ -650,6 +655,7 @@ void Cluster::makeOffer(const MemberId& id, Lock& ) { // callbacks will be invoked. // void Cluster::brokerShutdown() { + sys::ClusterSafeScope css; // Don't trigger cluster-safe asserts. try { cpg.shutdown(); } catch (const std::exception& e) { QPID_LOG(error, *this << " shutting down CPG: " << e.what()); -- cgit v1.2.1