mirror of https://github.com/apache/activemq.git
Applied patch for https://issues.apache.org/activemq/browse/AMQ-1511
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@646245 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
60ba951914
commit
f1b6362ded
|
@ -439,12 +439,17 @@ public class BrokerService implements Service {
|
|||
|
||||
getBroker().start();
|
||||
|
||||
/*
|
||||
* if(isUseJmx()){ // yes - this is order dependent! // register all
|
||||
* destination in persistence store including inactive destinations
|
||||
* as mbeans this.startDestinationsInPersistenceStore(broker); }
|
||||
*/
|
||||
startAllConnectors();
|
||||
// see if there is a MasterBroker service and if so, configure
|
||||
// it and start it.
|
||||
for (Service service : services) {
|
||||
if (service instanceof MasterConnector) {
|
||||
configureService(service);
|
||||
service.start();
|
||||
}
|
||||
}
|
||||
if (!isSlave()) {
|
||||
startAllConnectors();
|
||||
}
|
||||
|
||||
if (isUseJmx() && masterConnector != null) {
|
||||
registerFTConnectorMBean(masterConnector);
|
||||
|
@ -1301,6 +1306,7 @@ public class BrokerService implements Service {
|
|||
* @throws Exception
|
||||
*/
|
||||
protected void processHelperProperties() throws Exception {
|
||||
boolean masterServiceExists = false;
|
||||
if (transportConnectorURIs != null) {
|
||||
for (int i = 0; i < transportConnectorURIs.length; i++) {
|
||||
String uri = transportConnectorURIs[i];
|
||||
|
@ -1319,8 +1325,14 @@ public class BrokerService implements Service {
|
|||
addJmsConnector(jmsBridgeConnectors[i]);
|
||||
}
|
||||
}
|
||||
for (Service service : services) {
|
||||
if (service instanceof MasterConnector) {
|
||||
masterServiceExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (masterConnectorURI != null) {
|
||||
if (masterConnector != null) {
|
||||
if (masterServiceExists) {
|
||||
throw new IllegalStateException("Cannot specify masterConnectorURI when a masterConnector is already registered via the services property");
|
||||
} else {
|
||||
addService(new MasterConnector(masterConnectorURI));
|
||||
|
@ -1843,12 +1855,14 @@ public class BrokerService implements Service {
|
|||
*/
|
||||
protected void configureService(Object service) {
|
||||
if (service instanceof BrokerServiceAware) {
|
||||
BrokerServiceAware serviceAware = (BrokerServiceAware)service;
|
||||
BrokerServiceAware serviceAware = (BrokerServiceAware) service;
|
||||
serviceAware.setBrokerService(this);
|
||||
}
|
||||
if (service instanceof MasterConnector) {
|
||||
masterConnector = (MasterConnector)service;
|
||||
supportFailOver = true;
|
||||
if (masterConnector == null) {
|
||||
if (service instanceof MasterConnector) {
|
||||
masterConnector = (MasterConnector) service;
|
||||
supportFailOver = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ public class MasterConnector implements Service, BrokerServiceAware {
|
|||
}
|
||||
localBroker = TransportFactory.connect(localURI);
|
||||
remoteBroker = TransportFactory.connect(remoteURI);
|
||||
LOG.info("Starting a network connection between " + localBroker + " and " + remoteBroker + " has been established.");
|
||||
LOG.info("Starting a slave connection between " + localBroker + " and " + remoteBroker + " has been established.");
|
||||
localBroker.setTransportListener(new DefaultTransportListener() {
|
||||
|
||||
public void onCommand(Object command) {
|
||||
|
@ -131,21 +131,15 @@ public class MasterConnector implements Service, BrokerServiceAware {
|
|||
}
|
||||
}
|
||||
});
|
||||
masterActive.set(true);
|
||||
Thread thead = new Thread() {
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
localBroker.start();
|
||||
remoteBroker.start();
|
||||
startBridge();
|
||||
} catch (Exception e) {
|
||||
masterActive.set(false);
|
||||
LOG.error("Failed to start network bridge: " + e, e);
|
||||
}
|
||||
}
|
||||
};
|
||||
thead.start();
|
||||
try {
|
||||
localBroker.start();
|
||||
remoteBroker.start();
|
||||
startBridge();
|
||||
masterActive.set(true);
|
||||
} catch (Exception e) {
|
||||
masterActive.set(false);
|
||||
LOG.error("Failed to start network bridge: " + e, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void startBridge() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue