mirror of https://github.com/apache/activemq.git
Pass in broker name to the AMQPersistenceAdapter
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@514364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1191d5eeb2
commit
c3f4712ac9
|
@ -107,14 +107,25 @@ public class AMQPersistenceAdapter implements PersistenceAdapter, UsageListener
|
||||||
private Runnable periodicCleanupTask;
|
private Runnable periodicCleanupTask;
|
||||||
private boolean deleteAllMessages;
|
private boolean deleteAllMessages;
|
||||||
private boolean syncOnWrite;
|
private boolean syncOnWrite;
|
||||||
private File directory = new File(IOHelper.getDefaultDataDirectory() + "/amq");
|
private String brokerName;
|
||||||
|
private File directory;
|
||||||
|
|
||||||
|
|
||||||
|
public AMQPersistenceAdapter() {
|
||||||
|
this("localhost");
|
||||||
|
}
|
||||||
|
public AMQPersistenceAdapter(String brokerName) {
|
||||||
|
this.brokerName = brokerName;
|
||||||
|
this.directory=new File(IOHelper.getDefaultDataDirectory(),brokerName + "-amqstore");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public synchronized void start() throws Exception {
|
public synchronized void start() throws Exception {
|
||||||
if( !started.compareAndSet(false, true) )
|
if( !started.compareAndSet(false, true) )
|
||||||
return;
|
return;
|
||||||
|
if (this.usageManager!=null) {
|
||||||
this.usageManager.addUsageListener(this);
|
this.usageManager.addUsageListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
if( asyncDataManager == null ) {
|
if( asyncDataManager == null ) {
|
||||||
asyncDataManager = createAsyncDataManager();
|
asyncDataManager = createAsyncDataManager();
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class AMQStoreCursorDurableTest extends CursorDurableTest{
|
||||||
|
|
||||||
|
|
||||||
protected void configureBroker(BrokerService answer) throws Exception{
|
protected void configureBroker(BrokerService answer) throws Exception{
|
||||||
AMQPersistenceAdapter adaptor = new AMQPersistenceAdapter();
|
AMQPersistenceAdapter adaptor = new AMQPersistenceAdapter("localhost");
|
||||||
answer.setPersistenceAdapter(adaptor);
|
answer.setPersistenceAdapter(adaptor);
|
||||||
answer.setDeleteAllMessagesOnStartup(true);
|
answer.setDeleteAllMessagesOnStartup(true);
|
||||||
answer.addConnector(bindAddress);
|
answer.addConnector(bindAddress);
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class AMQStoreQueueStoreTest extends CursorQueueStoreTest{
|
||||||
|
|
||||||
|
|
||||||
protected void configureBroker(BrokerService answer) throws Exception{
|
protected void configureBroker(BrokerService answer) throws Exception{
|
||||||
PersistenceAdapter adaptor = new AMQPersistenceAdapter();
|
PersistenceAdapter adaptor = new AMQPersistenceAdapter("localhost");
|
||||||
answer.setPersistenceAdapter(adaptor);
|
answer.setPersistenceAdapter(adaptor);
|
||||||
PolicyEntry policy = new PolicyEntry();
|
PolicyEntry policy = new PolicyEntry();
|
||||||
policy.setPendingQueuePolicy(new StorePendingQueueMessageStoragePolicy());
|
policy.setPendingQueuePolicy(new StorePendingQueueMessageStoragePolicy());
|
||||||
|
|
|
@ -17,7 +17,6 @@ package org.apache.activemq.perf;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.apache.activemq.store.amq.AMQPersistenceAdapter;
|
import org.apache.activemq.store.amq.AMQPersistenceAdapter;
|
||||||
import org.apache.activemq.store.quick.QuickPersistenceAdapter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version $Revision: 1.3 $
|
* @version $Revision: 1.3 $
|
||||||
|
@ -27,10 +26,10 @@ public class AMQStoreDurableTopicTest extends SimpleDurableTopicTest{
|
||||||
|
|
||||||
protected void configureBroker(BrokerService answer) throws Exception{
|
protected void configureBroker(BrokerService answer) throws Exception{
|
||||||
File dataFileDir=new File("target/test-amq-data/perfTest/amqdb");
|
File dataFileDir=new File("target/test-amq-data/perfTest/amqdb");
|
||||||
AMQPersistenceAdapter adaptor = new AMQPersistenceAdapter();
|
AMQPersistenceAdapter adaptor = new AMQPersistenceAdapter("localhost");
|
||||||
adaptor.setDirectory(dataFileDir);
|
adaptor.setDirectory(dataFileDir);
|
||||||
answer.setPersistenceAdapter(adaptor);
|
answer.setPersistenceAdapter(adaptor);
|
||||||
answer.addConnector(bindAddress);
|
|
||||||
answer.setDeleteAllMessagesOnStartup(true);
|
answer.setDeleteAllMessagesOnStartup(true);
|
||||||
|
answer.addConnector(bindAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class AMQStoreQueueTest extends SimpleQueueTest{
|
||||||
|
|
||||||
File dataFileDir = new File("target/test-amq-data/perfTest/amq");
|
File dataFileDir = new File("target/test-amq-data/perfTest/amq");
|
||||||
|
|
||||||
AMQPersistenceAdapter adaptor = new AMQPersistenceAdapter();
|
AMQPersistenceAdapter adaptor = new AMQPersistenceAdapter("localhost");
|
||||||
adaptor.setDirectory(dataFileDir);
|
adaptor.setDirectory(dataFileDir);
|
||||||
|
|
||||||
answer.setPersistenceAdapter(adaptor);
|
answer.setPersistenceAdapter(adaptor);
|
||||||
|
|
Loading…
Reference in New Issue