From 381ff27cacc1f72a42504e8e698d33b59d145b30 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Fri, 26 Feb 2010 16:47:23 +0000 Subject: Fix cluster abort on shutdown in ClusterTimer::fire. The cluster destructor was not deleting the ClusterTimer set on the broker, so this timer had a dangling pointer to the cluster. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@916751 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/cluster/Cluster.cpp | 2 +- cpp/src/qpid/cluster/ClusterTimer.h | 6 ++++++ cpp/src/qpid/cluster/Cpg.cpp | 1 - cpp/src/qpid/sys/AggregateOutput.cpp | 4 +++- 4 files changed, 10 insertions(+), 3 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/qpid/cluster/Cluster.cpp b/cpp/src/qpid/cluster/Cluster.cpp index 08646e5a6b..f49fbb03a5 100644 --- a/cpp/src/qpid/cluster/Cluster.cpp +++ b/cpp/src/qpid/cluster/Cluster.cpp @@ -285,6 +285,7 @@ Cluster::Cluster(const ClusterSettings& set, broker::Broker& b) : } Cluster::~Cluster() { + broker.setClusterTimer(std::auto_ptr(0)); // Delete cluster timer if (updateThread.id()) updateThread.join(); // Join the previous updatethread. } @@ -1002,7 +1003,6 @@ void Cluster::errorCheck(const MemberId& from, uint8_t type, framing::SequenceNu } void Cluster::timerWakeup(const MemberId& , const std::string& name, Lock&) { - QPID_LOG(debug, "Cluster timer wakeup " << map.getFrameSeq() << ": " << name) timer->deliverWakeup(name); } diff --git a/cpp/src/qpid/cluster/ClusterTimer.h b/cpp/src/qpid/cluster/ClusterTimer.h index 395e505451..69f6c622e4 100644 --- a/cpp/src/qpid/cluster/ClusterTimer.h +++ b/cpp/src/qpid/cluster/ClusterTimer.h @@ -30,6 +30,12 @@ namespace cluster { class Cluster; +/** + * Timer implementation that executes tasks consistently in the + * deliver thread across a cluster. Task is not executed when timer + * fires, instead the elder multicasts a wakeup. The task is executed + * when the wakeup is delivered. + */ class ClusterTimer : public sys::Timer { public: ClusterTimer(Cluster&); diff --git a/cpp/src/qpid/cluster/Cpg.cpp b/cpp/src/qpid/cluster/Cpg.cpp index 3ae0c970c7..0856bcd824 100644 --- a/cpp/src/qpid/cluster/Cpg.cpp +++ b/cpp/src/qpid/cluster/Cpg.cpp @@ -54,7 +54,6 @@ void Cpg::callCpg ( CpgOp & c ) { unsigned int snooze = 10; for ( unsigned int nth_try = 0; nth_try < cpgRetries; ++ nth_try ) { if ( CPG_OK == (result = c.op(handle, & group))) { - QPID_LOG(info, c.opName << " successful."); break; } else if ( result == CPG_ERR_TRY_AGAIN ) { diff --git a/cpp/src/qpid/sys/AggregateOutput.cpp b/cpp/src/qpid/sys/AggregateOutput.cpp index 4f0a4fa5af..fc95f46fb9 100644 --- a/cpp/src/qpid/sys/AggregateOutput.cpp +++ b/cpp/src/qpid/sys/AggregateOutput.cpp @@ -34,6 +34,7 @@ void AggregateOutput::activateOutput() { control.activateOutput(); } void AggregateOutput::giveReadCredit(int32_t credit) { control.giveReadCredit(credit); } +namespace { // Clear the busy flag and notify waiting threads in destructor. struct ScopedBusy { bool& flag; @@ -41,7 +42,8 @@ struct ScopedBusy { ScopedBusy(bool& f, Monitor& m) : flag(f), monitor(m) { f = true; } ~ScopedBusy() { flag = false; monitor.notifyAll(); } }; - +} + bool AggregateOutput::doOutput() { Mutex::ScopedLock l(lock); ScopedBusy sb(busy, lock); -- cgit v1.2.1