Ensure store is properly deleted, even if not initialized

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@480185 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2006-11-28 20:08:26 +00:00
parent fbce65019c
commit 5c587a2f13
1 changed files with 9 additions and 1 deletions

View File

@ -166,6 +166,8 @@ public class KahaPersistenceAdapter implements PersistenceAdapter{
}else{
theStore.delete();
}
}else {
StoreFactory.delete(getStoreName());
}
}
@ -253,13 +255,19 @@ public class KahaPersistenceAdapter implements PersistenceAdapter{
this.maximumDestinationCacheSize=maximumDestinationCacheSize;
}
protected synchronized Store getStore() throws IOException{
if(theStore==null){
String name=dir.getAbsolutePath()+File.separator+"kaha.db";
theStore=StoreFactory.open(name,"rw");
theStore=StoreFactory.open(getStoreName(),"rw");
theStore.setMaxDataFileLength(maxDataFileLength);
theStore.setIndexType(indexType);
}
return theStore;
}
private String getStoreName(){
String name=dir.getAbsolutePath()+File.separator+"kahadb";
return name;
}
}