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

This commit is contained in:
gtully 2014-03-12 16:51:22 +00:00
parent 128921e687
commit 9c24716044
1 changed files with 6 additions and 4 deletions

View File

@ -1230,15 +1230,17 @@ public class Queue extends BaseDestination implements Task, UsageListener {
} }
private boolean shouldPageInMoreForBrowse(int max) { private boolean shouldPageInMoreForBrowse(int max) {
int alreadyPagedIn = 0;
pagedInMessagesLock.readLock().lock(); pagedInMessagesLock.readLock().lock();
try { try {
int alreadyPagedIn = pagedInMessages.size(); alreadyPagedIn = pagedInMessages.size();
return alreadyPagedIn < max
&& alreadyPagedIn < getDestinationStatistics().getMessages().getCount()
&& !memoryUsage.isFull(110);
} finally { } finally {
pagedInMessagesLock.readLock().unlock(); 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<? extends MessageReference> refs, List<Message> l, int max, private void addAll(Collection<? extends MessageReference> refs, List<Message> l, int max,