Author: ritchiem
Date: Fri Dec 11 15:03:29 2009
New Revision: 889645

URL: http://svn.apache.org/viewvc?rev=889645&view=rev
Log:
QPID-2263 : Stop Exceptions killing the HouseKeeping thread. Also prevented 
Deleted Messages from being processed by the notification checks.

Modified:
    
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
    
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java

Modified: 
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java?rev=889645&r1=889644&r2=889645&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
 (original)
+++ 
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
 Fri Dec 11 15:03:29 2009
@@ -1689,15 +1689,28 @@
         while (queueListIterator.advance())
         {
             QueueEntry node = queueListIterator.getNode();
-            if (!node.isDeleted() && node.expired() && node.acquire())
+            // Only process nodes that are not currently deleted
+            if (!node.isDeleted())
             {
-                dequeueEntry(node);
-            }
-            else
-            {
-                if(_managedObject!=null)
+                // If the node has exired then aquire it
+                if (node.expired() && node.acquire())
+                {
+                    // Then dequeue it.
+                    dequeueEntry(node);
+                }
+                else
                 {
-                    _managedObject.checkForNotification(node.getMessage());
+                    if (_managedObject != null)
+                    {
+                        // There is a chance that the node could be deleted by
+                        // the time the check actually occurs. So verify we
+                        // can actually get the message to perform the check.
+                        ServerMessage msg = node.getMessage();
+                        if (msg != null)
+                        {
+                            _managedObject.checkForNotification(msg);
+                        }
+                    }
                 }
             }
         }

Modified: 
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java?rev=889645&r1=889644&r2=889645&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java
 (original)
+++ 
qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java
 Fri Dec 11 15:03:29 2009
@@ -268,10 +268,11 @@
                         {
                             q.checkMessageStatus();
                         }
-                        catch (AMQException e)
+                        catch (Exception e)
                         {
                             _logger.error("Exception in housekeeping for 
queue: " + q.getName().toString(), e);
-                            throw new RuntimeException(e);
+                            //Don't throw exceptions as this will stop the
+                            // house keeping task from running.
                         }
                     }
                 }



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

Reply via email to