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(); }