diff options
author | Alan Conway <aconway@apache.org> | 2012-01-19 23:08:45 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2012-01-19 23:08:45 +0000 |
commit | 6e6a52390ef1cb265f326e9b8a9725287be291da (patch) | |
tree | c5ac09dc00ba2898a2a7ee721ae0d332f4c1a4b2 | |
parent | 95b1ef5e318fd5f9edfe00bfe9690001a3569d20 (diff) | |
download | qpid-python-6e6a52390ef1cb265f326e9b8a9725287be291da.tar.gz |
QPID-3603: Hide "queue deleted" errors detected for a ReplicatingSubscription.
This is not an error, its normal for ReplicatingSubscriptions to be still
running when a queue is deleted.
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid-3603-2@1233683 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/broker/Consumer.h | 5 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/broker/Queue.cpp | 6 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/broker/Queue.h | 2 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp | 4 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/ha/ReplicatingSubscription.h | 2 |
5 files changed, 15 insertions, 4 deletions
diff --git a/qpid/cpp/src/qpid/broker/Consumer.h b/qpid/cpp/src/qpid/broker/Consumer.h index 3330e3918f..b3d6f23732 100644 --- a/qpid/cpp/src/qpid/broker/Consumer.h +++ b/qpid/cpp/src/qpid/broker/Consumer.h @@ -70,6 +70,11 @@ class Consumer */ virtual void acknowledged(const QueuedMessage&) = 0; + /** Called if queue has been deleted, if true suppress the error message. + * Used by HA ReplicatingSubscriptions where such errors are normal. + */ + virtual bool hideDeletedError() { return false; } + protected: framing::SequenceNumber position; diff --git a/qpid/cpp/src/qpid/broker/Queue.cpp b/qpid/cpp/src/qpid/broker/Queue.cpp index 89a1839763..c30560cab1 100644 --- a/qpid/cpp/src/qpid/broker/Queue.cpp +++ b/qpid/cpp/src/qpid/broker/Queue.cpp @@ -278,7 +278,7 @@ void Queue::notifyListener() bool Queue::getNextMessage(QueuedMessage& m, Consumer::shared_ptr& c) { - checkNotDeleted(); + checkNotDeleted(c); if (c->preAcquires()) { switch (consumeNextMessage(m, c)) { case CONSUMED: @@ -1396,9 +1396,9 @@ QueueListeners& Queue::getListeners() { return listeners; } Messages& Queue::getMessages() { return *messages; } const Messages& Queue::getMessages() const { return *messages; } -void Queue::checkNotDeleted() +void Queue::checkNotDeleted(const Consumer::shared_ptr& c) { - if (deleted) { + if (deleted && !c->hideDeletedError()) { throw ResourceDeletedException(QPID_MSG("Queue " << getName() << " has been deleted.")); } } diff --git a/qpid/cpp/src/qpid/broker/Queue.h b/qpid/cpp/src/qpid/broker/Queue.h index 6049de6191..6a03ee5a4b 100644 --- a/qpid/cpp/src/qpid/broker/Queue.h +++ b/qpid/cpp/src/qpid/broker/Queue.h @@ -180,7 +180,7 @@ class Queue : public boost::enable_shared_from_this<Queue>, } } - void checkNotDeleted(); + void checkNotDeleted(const Consumer::shared_ptr& c); void notifyDeleted(); public: diff --git a/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp b/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp index 0070118102..33948f2d7e 100644 --- a/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp +++ b/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp @@ -196,6 +196,10 @@ void ReplicatingSubscription::acknowledged(const QueuedMessage& msg) { complete(msg, l); } +// Hide the "queue deleted" error for a ReplicatingSubscription when a +// queue is deleted, this is normal and not an error. +bool ReplicatingSubscription::hideDeletedError() { return true; } + // Called with lock held. Called in subscription's connection thread. void ReplicatingSubscription::sendDequeueEvent(const sys::Mutex::ScopedLock& l) { diff --git a/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h b/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h index 8af273e4d8..fa2093ac61 100644 --- a/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h +++ b/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h @@ -87,6 +87,8 @@ class ReplicatingSubscription : public broker::SemanticState::ConsumerImpl, void cancel(); void acknowledged(const broker::QueuedMessage&); + bool hideDeletedError(); + protected: bool doDispatch(); private: |