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();
|
getBroker().start();
|
||||||
|
|
||||||
/*
|
// see if there is a MasterBroker service and if so, configure
|
||||||
* if(isUseJmx()){ // yes - this is order dependent! // register all
|
// it and start it.
|
||||||
* destination in persistence store including inactive destinations
|
for (Service service : services) {
|
||||||
* as mbeans this.startDestinationsInPersistenceStore(broker); }
|
if (service instanceof MasterConnector) {
|
||||||
*/
|
configureService(service);
|
||||||
startAllConnectors();
|
service.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isSlave()) {
|
||||||
|
startAllConnectors();
|
||||||
|
}
|
||||||
|
|
||||||
if (isUseJmx() && masterConnector != null) {
|
if (isUseJmx() && masterConnector != null) {
|
||||||
registerFTConnectorMBean(masterConnector);
|
registerFTConnectorMBean(masterConnector);
|
||||||
|
@ -1301,6 +1306,7 @@ public class BrokerService implements Service {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected void processHelperProperties() throws Exception {
|
protected void processHelperProperties() throws Exception {
|
||||||
|
boolean masterServiceExists = false;
|
||||||
if (transportConnectorURIs != null) {
|
if (transportConnectorURIs != null) {
|
||||||
for (int i = 0; i < transportConnectorURIs.length; i++) {
|
for (int i = 0; i < transportConnectorURIs.length; i++) {
|
||||||
String uri = transportConnectorURIs[i];
|
String uri = transportConnectorURIs[i];
|
||||||
|
@ -1319,8 +1325,14 @@ public class BrokerService implements Service {
|
||||||
addJmsConnector(jmsBridgeConnectors[i]);
|
addJmsConnector(jmsBridgeConnectors[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (Service service : services) {
|
||||||
|
if (service instanceof MasterConnector) {
|
||||||
|
masterServiceExists = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (masterConnectorURI != null) {
|
if (masterConnectorURI != null) {
|
||||||
if (masterConnector != null) {
|
if (masterServiceExists) {
|
||||||
throw new IllegalStateException("Cannot specify masterConnectorURI when a masterConnector is already registered via the services property");
|
throw new IllegalStateException("Cannot specify masterConnectorURI when a masterConnector is already registered via the services property");
|
||||||
} else {
|
} else {
|
||||||
addService(new MasterConnector(masterConnectorURI));
|
addService(new MasterConnector(masterConnectorURI));
|
||||||
|
@ -1843,12 +1855,14 @@ public class BrokerService implements Service {
|
||||||
*/
|
*/
|
||||||
protected void configureService(Object service) {
|
protected void configureService(Object service) {
|
||||||
if (service instanceof BrokerServiceAware) {
|
if (service instanceof BrokerServiceAware) {
|
||||||
BrokerServiceAware serviceAware = (BrokerServiceAware)service;
|
BrokerServiceAware serviceAware = (BrokerServiceAware) service;
|
||||||
serviceAware.setBrokerService(this);
|
serviceAware.setBrokerService(this);
|
||||||
}
|
}
|
||||||
if (service instanceof MasterConnector) {
|
if (masterConnector == null) {
|
||||||
masterConnector = (MasterConnector)service;
|
if (service instanceof MasterConnector) {
|
||||||
supportFailOver = true;
|
masterConnector = (MasterConnector) service;
|
||||||
|
supportFailOver = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class MasterConnector implements Service, BrokerServiceAware {
|
||||||
}
|
}
|
||||||
localBroker = TransportFactory.connect(localURI);
|
localBroker = TransportFactory.connect(localURI);
|
||||||
remoteBroker = TransportFactory.connect(remoteURI);
|
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() {
|
localBroker.setTransportListener(new DefaultTransportListener() {
|
||||||
|
|
||||||
public void onCommand(Object command) {
|
public void onCommand(Object command) {
|
||||||
|
@ -131,21 +131,15 @@ public class MasterConnector implements Service, BrokerServiceAware {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
masterActive.set(true);
|
try {
|
||||||
Thread thead = new Thread() {
|
localBroker.start();
|
||||||
|
remoteBroker.start();
|
||||||
public void run() {
|
startBridge();
|
||||||
try {
|
masterActive.set(true);
|
||||||
localBroker.start();
|
} catch (Exception e) {
|
||||||
remoteBroker.start();
|
masterActive.set(false);
|
||||||
startBridge();
|
LOG.error("Failed to start network bridge: " + e, e);
|
||||||
} catch (Exception e) {
|
}
|
||||||
masterActive.set(false);
|
|
||||||
LOG.error("Failed to start network bridge: " + e, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
thead.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void startBridge() throws Exception {
|
protected void startBridge() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue