summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-02-17 14:11:30 +0000
committerAlan Conway <aconway@apache.org>2012-02-17 14:11:30 +0000
commit7f80263e6394bd19c70f49c7796e8b8a97e942e7 (patch)
treee60a8494993bd9c6ec5133edbe4f72dd097d6610
parent6cae9013851cdda93e316989eb607f2cbc640cd2 (diff)
downloadqpid-python-7f80263e6394bd19c70f49c7796e8b8a97e942e7.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-7@1245516 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: