From 9c247160440ecb4aa91903895e7fabb8ad9c92e5 Mon Sep 17 00:00:00 2001 From: gtully Date: Wed, 12 Mar 2014 16:51:22 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-4930 tracked hung org.apache.activemq.usecases.ExpiredMessagesWithNoConsumerTest#testExpiredMessagesWithNoConsumer - when using lower -Xmx than maven run - looping on browse due to no page when hasSpace fails. Browse picks up this state now --- .../java/org/apache/activemq/broker/region/Queue.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java index a8a864e58a..60c62285a1 100755 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/Queue.java @@ -1230,15 +1230,17 @@ public class Queue extends BaseDestination implements Task, UsageListener { } private boolean shouldPageInMoreForBrowse(int max) { + int alreadyPagedIn = 0; pagedInMessagesLock.readLock().lock(); try { - int alreadyPagedIn = pagedInMessages.size(); - return alreadyPagedIn < max - && alreadyPagedIn < getDestinationStatistics().getMessages().getCount() - && !memoryUsage.isFull(110); + alreadyPagedIn = pagedInMessages.size(); } finally { pagedInMessagesLock.readLock().unlock(); } + LOG.trace("max {}, alreadyPagedIn {}, messagesCount {}, memoryUsage {}%", new Object[]{max, alreadyPagedIn, destinationStatistics.getMessages().getCount(), memoryUsage.getPercentUsage()}); + return (alreadyPagedIn < max) + && (alreadyPagedIn < destinationStatistics.getMessages().getCount()) + && messages.hasSpace(); } private void addAll(Collection refs, List l, int max,