mirror of
https://github.com/apache/activemq.git
synced 2025-02-28 21:29:12 +00:00
https://issues.apache.org/jira/browse/AMQ-3533 - mKahaDB, allow the directory of a filtered destination to be specified, such that destination journals can be split across disks. Fixed with test
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1187280 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4b202c1d7a
commit
85edfb3425
@ -100,7 +100,7 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
|
||||
|
||||
public static final String PROPERTY_LOG_SLOW_ACCESS_TIME = "org.apache.activemq.store.kahadb.LOG_SLOW_ACCESS_TIME";
|
||||
public static final int LOG_SLOW_ACCESS_TIME = Integer.parseInt(System.getProperty(PROPERTY_LOG_SLOW_ACCESS_TIME, "0"));
|
||||
|
||||
public static final File DEFAULT_DIRECTORY = new File("KahaDB");
|
||||
protected static final Buffer UNMATCHED;
|
||||
static {
|
||||
UNMATCHED = new Buffer(new byte[]{});
|
||||
@ -202,7 +202,7 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
|
||||
protected boolean failIfDatabaseIsLocked;
|
||||
|
||||
protected boolean deleteAllMessages;
|
||||
protected File directory = new File("KahaDB");
|
||||
protected File directory = DEFAULT_DIRECTORY;
|
||||
protected Thread checkpointThread;
|
||||
protected boolean enableJournalDiskSyncs=true;
|
||||
protected boolean archiveDataLogs;
|
||||
|
@ -103,7 +103,9 @@ public class MultiKahaDBPersistenceAdapter extends DestinationMap implements Per
|
||||
if (filteredAdapter.getDestination() == null) {
|
||||
filteredAdapter.setDestination(matchAll);
|
||||
}
|
||||
adapter.setDirectory(new File(getDirectory(), nameFromDestinationFilter(filteredAdapter.getDestination())));
|
||||
if (MessageDatabase.DEFAULT_DIRECTORY.equals(adapter.getDirectory())) {
|
||||
adapter.setDirectory(new File(getDirectory(), nameFromDestinationFilter(filteredAdapter.getDestination())));
|
||||
}
|
||||
|
||||
// need a per store factory that will put the store in the branch qualifier to disiambiguate xid mbeans
|
||||
adapter.getStore().setTransactionIdTransformer(transactionIdTransformer);
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
package org.apache.activemq.store;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Vector;
|
||||
@ -175,6 +176,32 @@ public class StorePerDestinationTest {
|
||||
assertEquals("all transactions are complete", 0, brokerService.getBroker().getPreparedTransactions(null).length);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDirectoryDefault() throws Exception {
|
||||
MultiKahaDBPersistenceAdapter multiKahaDBPersistenceAdapter = new MultiKahaDBPersistenceAdapter();
|
||||
ArrayList<FilteredKahaDBPersistenceAdapter> adapters = new ArrayList<FilteredKahaDBPersistenceAdapter>();
|
||||
|
||||
FilteredKahaDBPersistenceAdapter otherFilteredKahaDBPersistenceAdapter =
|
||||
new FilteredKahaDBPersistenceAdapter();
|
||||
KahaDBPersistenceAdapter otherStore = createStore(false);
|
||||
File someOtherDisk = new File("target" + File.separator + "someOtherDisk");
|
||||
otherStore.setDirectory(someOtherDisk);
|
||||
otherFilteredKahaDBPersistenceAdapter.setPersistenceAdapter(otherStore);
|
||||
otherFilteredKahaDBPersistenceAdapter.setDestination(new ActiveMQQueue("Other"));
|
||||
adapters.add(otherFilteredKahaDBPersistenceAdapter);
|
||||
|
||||
FilteredKahaDBPersistenceAdapter filteredKahaDBPersistenceAdapterDefault =
|
||||
new FilteredKahaDBPersistenceAdapter();
|
||||
KahaDBPersistenceAdapter storeDefault = createStore(false);
|
||||
filteredKahaDBPersistenceAdapterDefault.setPersistenceAdapter(storeDefault);
|
||||
adapters.add(filteredKahaDBPersistenceAdapterDefault);
|
||||
|
||||
multiKahaDBPersistenceAdapter.setFilteredPersistenceAdapters(adapters);
|
||||
|
||||
assertEquals(multiKahaDBPersistenceAdapter.getDirectory(), storeDefault.getDirectory().getParentFile());
|
||||
assertEquals(someOtherDisk, otherStore.getDirectory());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSlowFastDestinationsStoreUsage() throws Exception {
|
||||
brokerService.start();
|
||||
|
Loading…
x
Reference in New Issue
Block a user