diff options
-rw-r--r-- | java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java | 27 | ||||
-rw-r--r-- | java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java | 5 |
2 files changed, 23 insertions, 9 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java b/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java index 3d5d99f0b0..825aa9795e 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java +++ b/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java @@ -1689,15 +1689,28 @@ public class SimpleAMQQueue implements AMQQueue, Subscription.StateListener 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); + } + } } } } diff --git a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java index 6826dcf324..78deeeb164 100644 --- a/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java +++ b/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java @@ -268,10 +268,11 @@ public class VirtualHostImpl implements Accessable, VirtualHost { 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. } } } |