From 7da608c411f3e4db9a33dae06967b6a218d480ad Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Fri, 11 Sep 2009 18:49:23 +0000 Subject: [PATCH] Fix for https://issues.apache.org/activemq/browse/AMQ-1813 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@813980 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/activemq/broker/BrokerService.java | 2 +- .../activemq/broker/ft/MasterConnector.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java index edb55953dc..9234a94f95 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java @@ -465,7 +465,7 @@ public class BrokerService implements Service { service.start(); } } - if (!isSlave()) { + if (!isSlave() && (this.masterConnector == null || isShutdownOnMasterFailure() == false)) { startAllConnectors(); } if (!stopped.get()) { diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterConnector.java b/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterConnector.java index 34fd24709c..7ac78b44ff 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterConnector.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterConnector.java @@ -74,6 +74,7 @@ public class MasterConnector implements Service, BrokerServiceAware { private final AtomicBoolean masterActive = new AtomicBoolean(); private BrokerInfo brokerInfo; private boolean firstConnection=true; + private boolean failedToStart; public MasterConnector() { } @@ -185,6 +186,7 @@ public class MasterConnector implements Service, BrokerServiceAware { }else{ LOG.info("Slave stopped before connected to the master."); } + setFailedToStart(true); } } @@ -348,4 +350,20 @@ public class MasterConnector implements Service, BrokerServiceAware { return stoppedBeforeStart.get(); } + /** + * Get the failedToStart + * @return the failedToStart + */ + public boolean isFailedToStart() { + return this.failedToStart; + } + + /** + * Set the failedToStart + * @param failedToStart the failedToStart to set + */ + public void setFailedToStart(boolean failedToStart) { + this.failedToStart = failedToStart; + } + }