summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-01-16 21:28:38 +0000
committerAlan Conway <aconway@apache.org>2012-01-16 21:28:38 +0000
commit2b616f12d671f36b379a7f1c80b93aca1073fe47 (patch)
treea8eed0a7b0b0ac50a9fb083ae9ec36a5d2573310
parent8f27db2b7518e5976b9c002d492e97fac3b161d9 (diff)
downloadqpid-python-2b616f12d671f36b379a7f1c80b93aca1073fe47.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@1232170 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/broker/Consumer.h5
-rw-r--r--qpid/cpp/src/qpid/broker/Queue.cpp6
-rw-r--r--qpid/cpp/src/qpid/broker/Queue.h2
-rw-r--r--qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp4
-rw-r--r--qpid/cpp/src/qpid/ha/ReplicatingSubscription.h2
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..e9d6b889a7 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: