summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-01-20 17:07:54 +0000
committerAlan Conway <aconway@apache.org>2010-01-20 17:07:54 +0000
commitcd3166280e53b8587d4d257b7898577b65edc0b7 (patch)
treefabdc0bf29f6c025648d84349faadb317cfa2e68 /cpp/src/qpid/cluster
parent8d124f581b0571a9edb5603e6c282a2ecc081b5b (diff)
downloadqpid-python-cd3166280e53b8587d4d257b7898577b65edc0b7.tar.gz
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
Diffstat (limited to 'cpp/src/qpid/cluster')
-rw-r--r--cpp/src/qpid/cluster/Cluster.cpp6
1 files changed, 6 insertions, 0 deletions
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 <map>
#include <ostream>
+
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());