From 3249682bdadcbbd14832a42f45b749886804e70f Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Fri, 25 Jan 2008 21:06:43 +0000 Subject: [PATCH] disable caching of messages for the Queue Cursor git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@615341 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/activemq/broker/region/Queue.java | 9 +++++---- .../broker/region/cursors/QueueStorePrefetch.java | 2 +- .../org/apache/activemq/store/amq/AMQMessageStore.java | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) 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 {