From a3b4c5a3580217c248b47539e125e3fa70adf276 Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Thu, 13 Dec 2007 09:19:36 +0000 Subject: [PATCH] Fix for https://issues.apache.org/activemq/browse/AMQ-1507 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@603863 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/activemq/broker/BrokerService.java | 1 + .../apache/activemq/store/amq/AMQPersistenceAdapter.java | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java index 83b5a65723..5073dc08dd 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java @@ -724,6 +724,7 @@ public class BrokerService implements Service { */ public void setPersistenceAdapter(PersistenceAdapter persistenceAdapter) { this.persistenceAdapter = persistenceAdapter; + configureService(this.persistenceAdapter); } public TaskRunnerFactory getTaskRunnerFactory() { diff --git a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java index cb405ef0b9..6c23dffb7e 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java @@ -140,6 +140,7 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, public void setBrokerService(BrokerService brokerService) { this.brokerService = brokerService; + Thread.dumpStack(); } public synchronized void start() throws Exception { @@ -149,8 +150,8 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, if (this.directory == null) { if (brokerService != null) { this.directory = brokerService.getBrokerDataDirectory(); + } else { - this.directory = new File(IOHelper.getDefaultDataDirectory(), IOHelper.toFileSystemSafeName(brokerName)); this.directory = new File(directory, "amqstore"); this.directoryPath=directory.getAbsolutePath(); @@ -159,10 +160,10 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener, if (this.directoryArchive == null) { this.directoryArchive = new File(this.directory,"archive"); } + this.directory.mkdirs(); lockFile = new RandomAccessFile(new File(directory, "lock"), "rw"); lock(); - LOG.info("AMQStore starting using directory: " + directory); - this.directory.mkdirs(); + LOG.info("AMQStore starting using directory: " + directory); if (archiveDataLogs) { this.directoryArchive.mkdirs(); }