diff --git a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/plist/PListStore.java b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/plist/PListStore.java index b2c0a1a710..b719ef63a9 100644 --- a/activemq-core/src/main/java/org/apache/activemq/store/kahadb/plist/PListStore.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/kahadb/plist/PListStore.java @@ -65,6 +65,7 @@ public class PListStore extends ServiceSupport implements BrokerServiceAware, Ru private int journalMaxWriteBatchSize = Journal.DEFAULT_MAX_WRITE_BATCH_SIZE; private boolean enableIndexWriteAsync = false; private boolean initialized = false; + private boolean lazyInit = true; // private int indexWriteBatchSize = PageFile.DEFAULT_WRITE_BATCH_SIZE; MetaData metaData = new MetaData(this); final MetaDataMarshaller metaDataMarshaller = new MetaDataMarshaller(this); @@ -319,6 +320,9 @@ public class PListStore extends ServiceSupport implements BrokerServiceAware, Ru @Override protected synchronized void doStart() throws Exception { + if (!lazyInit) { + intialize(); + } LOG.info(this + " started"); } @@ -464,6 +468,14 @@ public class PListStore extends ServiceSupport implements BrokerServiceAware, Ru this.cleanupInterval = cleanupInterval; } + public boolean isLazyInit() { + return lazyInit; + } + + public void setLazyInit(boolean lazyInit) { + this.lazyInit = lazyInit; + } + @Override public String toString() { String path = getDirectory() != null ? getDirectory().getAbsolutePath() : "DIRECTORY_NOT_SET"; diff --git a/activemq-core/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java b/activemq-core/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java index ce190dd69a..5d392fedc5 100644 --- a/activemq-core/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java @@ -180,6 +180,7 @@ public class PListTest { store.setCleanupInterval(400); store.setDirectory(directory); store.setJournalMaxFileLength(1024*5); + store.setLazyInit(false); store.start(); final ByteSequence payload = new ByteSequence(new byte[1024*2]);