From 4e115887da892949d4891df37d62d6ac46b61200 Mon Sep 17 00:00:00 2001 From: Kenneth Anthony Giusti Date: Tue, 3 May 2011 22:13:52 +0000 Subject: QPID-3244: C++ broker should release flow control for a queue when it is deleted. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1099283 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/QueueFlowLimit.cpp | 15 +++++++++++++++ cpp/src/qpid/broker/QueueFlowLimit.h | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'cpp') diff --git a/cpp/src/qpid/broker/QueueFlowLimit.cpp b/cpp/src/qpid/broker/QueueFlowLimit.cpp index 9f1d3b65f8..b2e2e54bdf 100644 --- a/cpp/src/qpid/broker/QueueFlowLimit.cpp +++ b/cpp/src/qpid/broker/QueueFlowLimit.cpp @@ -120,6 +120,21 @@ QueueFlowLimit::QueueFlowLimit(Queue *_queue, } +QueueFlowLimit::~QueueFlowLimit() +{ + sys::Mutex::ScopedLock l(indexLock); + if (!index.empty()) { + // we're gone - release all pending msgs + for (std::map >::iterator itr = index.begin(); + itr != index.end(); ++itr) + if (itr->second) + try { + itr->second->getIngressCompletion().finishCompleter(); + } catch (...) {} // ignore - not safe for a destructor to throw. + index.clear(); + } +} + void QueueFlowLimit::enqueued(const QueuedMessage& msg) { diff --git a/cpp/src/qpid/broker/QueueFlowLimit.h b/cpp/src/qpid/broker/QueueFlowLimit.h index 5fdae39c29..ded27fb8bb 100644 --- a/cpp/src/qpid/broker/QueueFlowLimit.h +++ b/cpp/src/qpid/broker/QueueFlowLimit.h @@ -78,7 +78,7 @@ class Broker; static QPID_BROKER_EXTERN const std::string flowStopSizeKey; static QPID_BROKER_EXTERN const std::string flowResumeSizeKey; - virtual ~QueueFlowLimit() {} + virtual ~QueueFlowLimit(); /** the queue has added QueuedMessage. Returns true if flow state changes */ QPID_BROKER_EXTERN void enqueued(const QueuedMessage&); -- cgit v1.2.1