Fix for https://issues.apache.org/activemq/browse/AMQ-1382... if the broker.persistent==false then we should not create any files, not even for the Temp Store.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@573397 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2007-09-06 22:14:34 +00:00
parent b81dd2886e
commit 222daf2323
3 changed files with 14 additions and 3 deletions

View File

@ -1067,6 +1067,11 @@ public class BrokerService implements Service {
*/
public synchronized Store getTempDataStore() {
if (tempDataStore == null) {
if (!isPersistent()) {
return null;
}
boolean result = true;
boolean empty = true;
try {

View File

@ -118,7 +118,7 @@ public class Queue implements Destination, Task {
this.memoryUsage = new MemoryUsage(systemUsage.getMemoryUsage(), destination.toString());
this.memoryUsage.setUsagePortion(1.0f);
this.store = store;
if (destination.isTemporary()) {
if (destination.isTemporary() || tmpStore==null ) {
this.messages = new VMPendingMessageCursor();
} else {
this.messages = new StoreQueueCursor(this, tmpStore);

View File

@ -26,6 +26,7 @@ import org.apache.activemq.broker.Broker;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.broker.region.cursors.FilePendingMessageCursor;
import org.apache.activemq.broker.region.cursors.PendingMessageCursor;
import org.apache.activemq.broker.region.cursors.VMPendingMessageCursor;
import org.apache.activemq.broker.region.policy.MessageEvictionStrategy;
import org.apache.activemq.broker.region.policy.OldestMessageEvictionStrategy;
import org.apache.activemq.command.ConsumerControl;
@ -36,6 +37,7 @@ import org.apache.activemq.command.MessageDispatch;
import org.apache.activemq.command.MessageDispatchNotification;
import org.apache.activemq.command.MessagePull;
import org.apache.activemq.command.Response;
import org.apache.activemq.kaha.Store;
import org.apache.activemq.transaction.Synchronization;
import org.apache.activemq.usage.SystemUsage;
import org.apache.commons.logging.Log;
@ -66,8 +68,12 @@ public class TopicSubscription extends AbstractSubscription {
super(broker, context, info);
this.usageManager = usageManager;
String matchedName = "TopicSubscription:" + CURSOR_NAME_COUNTER.getAndIncrement() + "[" + info.getConsumerId().toString() + "]";
this.matched = new FilePendingMessageCursor(matchedName, broker.getTempDataStore());
Store tempDataStore = broker.getTempDataStore();
if (tempDataStore != null) {
this.matched = new FilePendingMessageCursor(matchedName, tempDataStore);
} else {
this.matched = new VMPendingMessageCursor();
}
}
public void init() throws Exception {