https://issues.apache.org/jira/browse/AMQ-3696 - fix regression in FailoverStaticNetworkTest, in jvm slave overwriting broker registry entry of master

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1364973 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2012-07-24 10:49:47 +00:00
parent 51927e6f89
commit 0051c4ea6f
1 changed files with 6 additions and 1 deletions

View File

@ -520,9 +520,14 @@ public class BrokerService implements Service {
if (isUseJmx()) {
startManagementContext();
}
BrokerRegistry.getInstance().bind(getBrokerName(), BrokerService.this);
// in jvm master slave, lets not publish over existing broker till we get the lock
final BrokerRegistry brokerRegistry = BrokerRegistry.getInstance();
if (brokerRegistry.lookup(getBrokerName()) == null) {
brokerRegistry.bind(getBrokerName(), BrokerService.this);
}
startPersistenceAdapter(startAsync);
startBroker(startAsync);
brokerRegistry.bind(getBrokerName(), BrokerService.this);
} catch (Exception e) {
LOG.error("Failed to start ActiveMQ JMS Message Broker (" + getBrokerName() + ", " + brokerId + "). Reason: " + e, e);
try {