expose the Journal property directoryArchive through KahaDB

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@898693 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2010-01-13 09:58:32 +00:00
parent f8cb8475ed
commit 98bb7bfd90
2 changed files with 30 additions and 9 deletions

View File

@ -370,19 +370,20 @@ public class KahaDBPersistenceAdapter implements PersistenceAdapter, BrokerServi
public void setBrokerService(BrokerService brokerService) {
letter.setBrokerService(brokerService);
}
/**
* @return the archiveDataLogs
*/
public boolean isArchiveDataLogs() {
return letter.isArchiveDataLogs();
}
/**
* @param archiveDataLogs the archiveDataLogs to set
*/
public void setArchiveDataLogs(boolean archiveDataLogs) {
letter.setArchiveDataLogs(archiveDataLogs);
}
public File getDirectoryArchive() {
return letter.getDirectoryArchive();
}
public void setDirectoryArchive(File directoryArchive) {
letter.setDirectoryArchive(directoryArchive);
}
}

View File

@ -56,6 +56,7 @@ import org.apache.activemq.store.kahadb.data.KahaTraceCommand;
import org.apache.activemq.store.kahadb.data.KahaTransactionInfo;
import org.apache.activemq.store.kahadb.data.KahaXATransactionId;
import org.apache.activemq.util.Callback;
import org.apache.activemq.util.IOHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.kahadb.index.BTreeIndex;
@ -158,6 +159,7 @@ public class MessageDatabase implements BrokerServiceAware {
protected Thread checkpointThread;
protected boolean enableJournalDiskSyncs=true;
protected boolean archiveDataLogs;
protected File directoryArchive;
long checkpointInterval = 5*1000;
long cleanupInterval = 30*1000;
int journalMaxFileLength = Journal.DEFAULT_MAX_FILE_LENGTH;
@ -1417,7 +1419,7 @@ public class MessageDatabase implements BrokerServiceAware {
return index;
}
private Journal createJournal() {
private Journal createJournal() throws IOException {
Journal manager = new Journal();
manager.setDirectory(directory);
manager.setMaxFileLength(getJournalMaxFileLength());
@ -1425,6 +1427,10 @@ public class MessageDatabase implements BrokerServiceAware {
manager.setChecksum(checksumJournalFiles || checkForCorruptJournalFiles);
manager.setWriteBatchSize(getJournalMaxWriteBatchSize());
manager.setArchiveDataLogs(isArchiveDataLogs());
if (getDirectoryArchive() != null) {
IOHelper.mkdirs(getDirectoryArchive());
manager.setDirectoryArchive(getDirectoryArchive());
}
return manager;
}
@ -1507,7 +1513,7 @@ public class MessageDatabase implements BrokerServiceAware {
return pageFile;
}
public Journal getJournal() {
public Journal getJournal() throws IOException {
if (journal == null) {
journal = createJournal();
}
@ -1571,4 +1577,18 @@ public class MessageDatabase implements BrokerServiceAware {
public void setArchiveDataLogs(boolean archiveDataLogs) {
this.archiveDataLogs = archiveDataLogs;
}
/**
* @return the directoryArchive
*/
public File getDirectoryArchive() {
return this.directoryArchive;
}
/**
* @param directoryArchive the directoryArchive to set
*/
public void setDirectoryArchive(File directoryArchive) {
this.directoryArchive = directoryArchive;
}
}