Author: aconway
Date: Thu Jan 19 23:08:45 2012
New Revision: 1233683

URL: http://svn.apache.org/viewvc?rev=1233683&view=rev
Log:
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.

Modified:
    qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Consumer.h
    qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Queue.cpp
    qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Queue.h
    qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp
    qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h

Modified: qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Consumer.h
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Consumer.h?rev=1233683&r1=1233682&r2=1233683&view=diff
==============================================================================
--- qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Consumer.h (original)
+++ qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Consumer.h Thu Jan 19 
23:08:45 2012
@@ -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;
 

Modified: qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Queue.cpp
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Queue.cpp?rev=1233683&r1=1233682&r2=1233683&view=diff
==============================================================================
--- qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Queue.cpp (original)
+++ qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Queue.cpp Thu Jan 19 
23:08:45 2012
@@ -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() { 
 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."));
     }
 }

Modified: qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Queue.h
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Queue.h?rev=1233683&r1=1233682&r2=1233683&view=diff
==============================================================================
--- qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Queue.h (original)
+++ qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/broker/Queue.h Thu Jan 19 
23:08:45 2012
@@ -180,7 +180,7 @@ class Queue : public boost::enable_share
         }
     }
 
-    void checkNotDeleted();
+    void checkNotDeleted(const Consumer::shared_ptr& c);
     void notifyDeleted();
 
   public:

Modified: 
qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp?rev=1233683&r1=1233682&r2=1233683&view=diff
==============================================================================
--- qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp 
(original)
+++ qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/ha/ReplicatingSubscription.cpp 
Thu Jan 19 23:08:45 2012
@@ -196,6 +196,10 @@ void ReplicatingSubscription::acknowledg
     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)
 {

Modified: 
qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h
URL: 
http://svn.apache.org/viewvc/qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h?rev=1233683&r1=1233682&r2=1233683&view=diff
==============================================================================
--- qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h 
(original)
+++ qpid/branches/qpid-3603-2/qpid/cpp/src/qpid/ha/ReplicatingSubscription.h 
Thu Jan 19 23:08:45 2012
@@ -87,6 +87,8 @@ class ReplicatingSubscription : public b
     void cancel();
     void acknowledged(const broker::QueuedMessage&);
 
+    bool hideDeletedError();
+
   protected:
     bool doDispatch();
   private:



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to