mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-4930 - limit browse page in iterations in case cursor and store are out of sync - avoid a spin when store does not return messages
This commit is contained in:
parent
41ca0d9464
commit
8216e7f4d5
|
@ -1104,8 +1104,15 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index
|
|||
public void doBrowse(List<Message> browseList, int max) {
|
||||
final ConnectionContext connectionContext = createConnectionContext();
|
||||
try {
|
||||
int maxPageInAttempts = 1;
|
||||
messagesLock.readLock().lock();
|
||||
try {
|
||||
maxPageInAttempts += (messages.size() / getMaxPageSize());
|
||||
} finally {
|
||||
messagesLock.readLock().unlock();
|
||||
}
|
||||
|
||||
while (shouldPageInMoreForBrowse(max)) {
|
||||
while (shouldPageInMoreForBrowse(max) && maxPageInAttempts-- > 0) {
|
||||
pageInMessages(!memoryUsage.isFull(110));
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue