From f405a7e80ddda5fef0b282aa09783ca45da10605 Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Thu, 14 Aug 2008 17:43:07 +0000 Subject: [PATCH] Applied patch https://issues.apache.org/activemq/browse/AMQ-1878 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@685971 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/activemq/broker/region/Queue.java | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java index 3453b48da8..3f27818388 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java @@ -241,24 +241,12 @@ public class Queue extends BaseDestination implements Task { ((QueueBrowserSubscription)sub).incrementQueueRef(); } -// System.out.println(new Date()+": Locked pagedInMessages: "+sub.getConsumerInfo().getConsumerId()); -// // Add all the matching messages in the queue to the -// // subscription. -// -// for (QueueMessageReference node:pagedInMessages.values()){ -// if (!node.isDropped() && !node.isAcked() && (!node.isDropped() ||sub.getConsumerInfo().isBrowser())) { -// msgContext.setMessageReference(node); -// if (sub.matches(node, msgContext)) { -// sub.add(node); -// } -// } -// } -// -// } - wakeup(); }finally { dispatchLock.unlock(); } + // Outside of dispatchLock() to maintain the lock hierarchy of + // iteratingMutex -> dispatchLock. - see https://issues.apache.org/activemq/browse/AMQ-1878 + wakeup(); } public void removeSubscription(ConnectionContext context, Subscription sub) @@ -312,10 +300,12 @@ public class Queue extends BaseDestination implements Task { if (consumers.isEmpty()) { messages.gc(); } - wakeup(); }finally { dispatchLock.unlock(); } + // Outside of dispatchLock() to maintain the lock hierarchy of + // iteratingMutex -> dispatchLock. - see https://issues.apache.org/activemq/browse/AMQ-1878 + wakeup(); } public void send(final ProducerBrokerExchange producerExchange, final Message message) throws Exception {