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 aa15d175aa..71c7472cf4 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 @@ -874,15 +874,16 @@ public class Queue extends BaseDestination implements Task { */ public boolean iterate() { - while (!messagesWaitingForSpace.isEmpty() &&!memoryUsage.isFull()) { - Runnable op = messagesWaitingForSpace.removeFirst(); - op.run(); - } try { pageInMessages(false); } catch (Exception e) { log.error("Failed to page in more queue messages ", e); } + while (!messagesWaitingForSpace.isEmpty() &&!memoryUsage.isFull()) { + Runnable op = messagesWaitingForSpace.removeFirst(); + op.run(); + } + return false; } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/QueueStorePrefetch.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/QueueStorePrefetch.java index 86d7e3cc68..5ab720bd52 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/QueueStorePrefetch.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/cursors/QueueStorePrefetch.java @@ -109,7 +109,7 @@ class QueueStorePrefetch extends AbstractPendingMessageCursor implements Message public synchronized void remove() { size--; - if (size==0 && isStarted()) { + if (size==0 && isStarted() && cacheEnabled) { cacheEnabled=true; } } diff --git a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java index f8d0cabd26..641e4e75dc 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQMessageStore.java @@ -483,7 +483,7 @@ public class AMQMessageStore implements MessageStore { } public void recoverNextMessages(int maxReturned, MessageRecoveryListener listener) throws Exception { - + /* RecoveryListenerAdapter recoveryListener = new RecoveryListenerAdapter( this, listener); if (referenceStore.supportsExternalBatchControl()) { @@ -510,14 +510,14 @@ public class AMQMessageStore implements MessageStore { flush(); referenceStore.recoverNextMessages(maxReturned, recoveryListener); } - /* + */ RecoveryListenerAdapter recoveryListener = new RecoveryListenerAdapter(this, listener); referenceStore.recoverNextMessages(maxReturned, recoveryListener); if (recoveryListener.size() == 0 && recoveryListener.hasSpace()) { flush(); referenceStore.recoverNextMessages(maxReturned, recoveryListener); } - */ + } Message getMessage(ReferenceData data) throws IOException {