From 7614fe25b742e25c0d579a692a9b6a39547064dc Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Sun, 27 Jul 2008 18:22:01 +0000 Subject: [PATCH] Fix for https://issues.apache.org/activemq/browse/AMQ-1866 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@680161 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/activemq/broker/region/Queue.java | 2 +- .../src/test/java/org/apache/activemq/bugs/AMQ1866.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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 5959b6e65a..d6234f15fb 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 @@ -1164,7 +1164,7 @@ public class Queue extends BaseDestination implements Task { // pick the least loaded to add the message too for (Subscription s : targets) { if (target == null - || target.getInFlightUsage() > s.getInFlightUsage()) { + || target.getPendingQueueSize() > s.getPendingQueueSize()) { target = s; } } diff --git a/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1866.java b/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1866.java index 69ac3de787..7c29c48fb1 100644 --- a/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1866.java +++ b/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ1866.java @@ -33,6 +33,7 @@ import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.region.policy.PolicyEntry; import org.apache.activemq.broker.region.policy.PolicyMap; import org.apache.activemq.command.ActiveMQQueue; +import org.apache.activemq.store.amq.AMQPersistenceAdapter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -60,6 +61,9 @@ public class AMQ1866 extends TestCase { protected void setUp() throws Exception { // Start an embedded broker up. brokerService = new BrokerService(); + AMQPersistenceAdapter adaptor = new AMQPersistenceAdapter(); + adaptor.setIndexBinSize(4096); + brokerService.setPersistenceAdapter(adaptor); brokerService.deleteAllMessages(); // A small max page size makes this issue occur faster.