https://issues.apache.org/jira/browse/AMQ-3490 - allow optional lazyInit of temp (plist) store

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1172528 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2011-09-19 09:03:13 +00:00
parent 943db3c3cb
commit 7d082c36bb
2 changed files with 13 additions and 0 deletions

View File

@ -65,6 +65,7 @@ public class PListStore extends ServiceSupport implements BrokerServiceAware, Ru
private int journalMaxWriteBatchSize = Journal.DEFAULT_MAX_WRITE_BATCH_SIZE; private int journalMaxWriteBatchSize = Journal.DEFAULT_MAX_WRITE_BATCH_SIZE;
private boolean enableIndexWriteAsync = false; private boolean enableIndexWriteAsync = false;
private boolean initialized = false; private boolean initialized = false;
private boolean lazyInit = true;
// private int indexWriteBatchSize = PageFile.DEFAULT_WRITE_BATCH_SIZE; // private int indexWriteBatchSize = PageFile.DEFAULT_WRITE_BATCH_SIZE;
MetaData metaData = new MetaData(this); MetaData metaData = new MetaData(this);
final MetaDataMarshaller metaDataMarshaller = new MetaDataMarshaller(this); final MetaDataMarshaller metaDataMarshaller = new MetaDataMarshaller(this);
@ -319,6 +320,9 @@ public class PListStore extends ServiceSupport implements BrokerServiceAware, Ru
@Override @Override
protected synchronized void doStart() throws Exception { protected synchronized void doStart() throws Exception {
if (!lazyInit) {
intialize();
}
LOG.info(this + " started"); LOG.info(this + " started");
} }
@ -464,6 +468,14 @@ public class PListStore extends ServiceSupport implements BrokerServiceAware, Ru
this.cleanupInterval = cleanupInterval; this.cleanupInterval = cleanupInterval;
} }
public boolean isLazyInit() {
return lazyInit;
}
public void setLazyInit(boolean lazyInit) {
this.lazyInit = lazyInit;
}
@Override @Override
public String toString() { public String toString() {
String path = getDirectory() != null ? getDirectory().getAbsolutePath() : "DIRECTORY_NOT_SET"; String path = getDirectory() != null ? getDirectory().getAbsolutePath() : "DIRECTORY_NOT_SET";

View File

@ -180,6 +180,7 @@ public class PListTest {
store.setCleanupInterval(400); store.setCleanupInterval(400);
store.setDirectory(directory); store.setDirectory(directory);
store.setJournalMaxFileLength(1024*5); store.setJournalMaxFileLength(1024*5);
store.setLazyInit(false);
store.start(); store.start();
final ByteSequence payload = new ByteSequence(new byte[1024*2]); final ByteSequence payload = new ByteSequence(new byte[1024*2]);