summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-02-14 16:06:50 +0000
committerAlan Conway <aconway@apache.org>2012-02-14 16:06:50 +0000
commit2cee1e8cd1bcee60f680363ea17300842a30f062 (patch)
tree1c29813e7226c7f46093bec97e6e0c4646b0bde4
parentbbf4e6c547e2e57749fae51fcdd1277f603d70e4 (diff)
downloadqpid-python-2cee1e8cd1bcee60f680363ea17300842a30f062.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-6@1244069 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..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 de60484189..0e822d3d4a 100644
--- a/qpid/cpp/src/qpid/broker/Queue.cpp
+++ b/qpid/cpp/src/qpid/broker/Queue.cpp
@@ -306,7 +306,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:
@@ -1539,9 +1539,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 f30a4196db..e8573c17cc 100644
--- a/qpid/cpp/src/qpid/broker/Queue.h
+++ b/qpid/cpp/src/qpid/broker/Queue.h
@@ -189,7 +189,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: