Don't use FilePendingMessageCursor if persitence is off

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@635932 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-03-11 14:05:20 +00:00
parent 0c45ad5778
commit 512b0c7e67
2 changed files with 15 additions and 18 deletions

View File

@ -64,7 +64,16 @@ public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor {
this.subscription=subscription;
this.clientId = clientId;
this.subscriberName = subscriberName;
this.nonPersistent = new FilePendingMessageCursor(broker,clientId + subscriberName);
if (broker.getBrokerService().isPersistent()) {
this.nonPersistent = new FilePendingMessageCursor(broker,clientId + subscriberName);
}else {
this.nonPersistent = new VMPendingMessageCursor();
}
this.nonPersistent.setMaxBatchSize(getMaxBatchSize());
this.nonPersistent.setSystemUsage(systemUsage);
this.nonPersistent.setEnableAudit(isEnableAudit());
this.nonPersistent.setMaxAuditDepth(getMaxAuditDepth());
this.nonPersistent.setMaxProducersToAudit(getMaxProducersToAudit());
this.storePrefetches.add(this.nonPersistent);
}
@ -180,7 +189,6 @@ public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor {
}
public synchronized void clear() {
nonPersistent.clear();
for (PendingMessageCursor tsp : storePrefetches) {
tsp.clear();
}
@ -267,9 +275,6 @@ public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor {
for (PendingMessageCursor cursor : storePrefetches) {
cursor.setMaxAuditDepth(maxAuditDepth);
}
if (nonPersistent != null) {
nonPersistent.setMaxProducersToAudit(maxProducersToAudit);
}
}
public synchronized void setMaxAuditDepth(int maxAuditDepth) {
@ -277,9 +282,6 @@ public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor {
for (PendingMessageCursor cursor : storePrefetches) {
cursor.setMaxAuditDepth(maxAuditDepth);
}
if (nonPersistent != null) {
nonPersistent.setMaxAuditDepth(maxAuditDepth);
}
}
public synchronized void setEnableAudit(boolean enableAudit) {
@ -287,9 +289,6 @@ public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor {
for (PendingMessageCursor cursor : storePrefetches) {
cursor.setEnableAudit(enableAudit);
}
if (nonPersistent != null) {
nonPersistent.setEnableAudit(enableAudit);
}
}
public synchronized void setUseCache(boolean useCache) {
@ -297,9 +296,6 @@ public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor {
for (PendingMessageCursor cursor : storePrefetches) {
cursor.setUseCache(useCache);
}
if (nonPersistent != null) {
nonPersistent.setUseCache(useCache);
}
}
/**
@ -311,9 +307,6 @@ public class StoreDurableSubscriberCursor extends AbstractPendingMessageCursor {
for (PendingMessageCursor cursor : storePrefetches) {
cursor.dispatched(message);
}
if (nonPersistent != null) {
nonPersistent.dispatched(message);
}
}
protected synchronized PendingMessageCursor getNextCursor() throws Exception {

View File

@ -59,7 +59,11 @@ public class StoreQueueCursor extends AbstractPendingMessageCursor {
started = true;
super.start();
if (nonPersistent == null) {
nonPersistent = new FilePendingMessageCursor(broker,queue.getName());
if (broker.getBrokerService().isPersistent()) {
nonPersistent = new FilePendingMessageCursor(broker,queue.getName());
}else {
nonPersistent = new VMPendingMessageCursor();
}
nonPersistent.setMaxBatchSize(getMaxBatchSize());
nonPersistent.setSystemUsage(systemUsage);
nonPersistent.setEnableAudit(isEnableAudit());