From eebe1358d23859d872c4aae38681262e8fcd6b22 Mon Sep 17 00:00:00 2001 From: Bosanac Dejan Date: Wed, 18 Jul 2012 16:19:31 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-3696 - use startAsync property instead of separate method git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1363003 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/activemq/broker/BrokerService.java | 27 +++++++++---------- .../activemq/xbean/XBeanBrokerService.java | 2 +- .../activemq/karaf/commands/blueprint.xml | 2 +- .../apache/activemq/karaf/commands/spring.xml | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) 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 7dab073f70..b426c6849c 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 @@ -222,8 +222,8 @@ public class BrokerService implements Service { private DestinationFilter virtualConsumerDestinationFilter; private final Object persistenceAdapterLock = new Object(); - private boolean persistenceAdapterStarted = false; private Throwable startException = null; + private boolean startAsync = false; static { String localHostName = "localhost"; @@ -496,19 +496,11 @@ public class BrokerService implements Service { @PostConstruct public void autoStart() throws Exception { if(shouldAutostart()) { - startAsync(); + start(); } } public void start() throws Exception { - doStart(false); - } - - public void startAsync() throws Exception { - doStart(true); - } - - public void doStart(boolean async) throws Exception { if (stopped.get() || !started.compareAndSet(false, true)) { // lets just ignore redundant start() calls // as its way too easy to not be completely sure if start() has been @@ -529,9 +521,8 @@ public class BrokerService implements Service { startManagementContext(); } - startPersistenceAdapter(async); - startBroker(async); - startedLatch.countDown(); + startPersistenceAdapter(startAsync); + startBroker(startAsync); } catch (Exception e) { LOG.error("Failed to start ActiveMQ JMS Message Broker (" + getBrokerName() + ", " + brokerId + "). Reason: " + e, e); try { @@ -599,7 +590,6 @@ public class BrokerService implements Service { } private void doStartBroker() throws Exception { - if (startException != null) { return; } @@ -644,6 +634,7 @@ public class BrokerService implements Service { LOG.info("ActiveMQ JMS Message Broker (" + getBrokerName() + ", " + brokerId + ") started"); getBroker().brokerServiceStarted(); checkSystemUsageLimits(); + startedLatch.countDown(); } /** @@ -2790,4 +2781,12 @@ public class BrokerService implements Service { public Throwable getStartException() { return startException; } + + public boolean isStartAsync() { + return startAsync; + } + + public void setStartAsync(boolean startAsync) { + this.startAsync = startAsync; + } } diff --git a/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java b/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java index e3d6f54ac6..467f5cbc54 100644 --- a/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java +++ b/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java @@ -57,7 +57,7 @@ public class XBeanBrokerService extends BrokerService { public void afterPropertiesSet() throws Exception { ensureSystemUsageHasStore(); if (shouldAutostart()) { - startAsync(); + start(); } } diff --git a/activemq-karaf/src/main/resources/org/apache/activemq/karaf/commands/blueprint.xml b/activemq-karaf/src/main/resources/org/apache/activemq/karaf/commands/blueprint.xml index c231c19ee5..a0e50903a7 100644 --- a/activemq-karaf/src/main/resources/org/apache/activemq/karaf/commands/blueprint.xml +++ b/activemq-karaf/src/main/resources/org/apache/activemq/karaf/commands/blueprint.xml @@ -22,7 +22,7 @@ - + - +