diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java index bf8f4a901d..1d1f6f5cc5 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/RegionBroker.java @@ -181,7 +181,6 @@ public class RegionBroker extends EmptyBroker { @Override public void start() throws Exception { - ((TopicRegion)topicRegion).setKeepDurableSubsActive(keepDurableSubsActive); started = true; queueRegion.start(); topicRegion.start(); @@ -722,6 +721,7 @@ public class RegionBroker extends EmptyBroker { public void setKeepDurableSubsActive(boolean keepDurableSubsActive) { this.keepDurableSubsActive = keepDurableSubsActive; + ((TopicRegion)topicRegion).setKeepDurableSubsActive(keepDurableSubsActive); } public DestinationInterceptor getDestinationInterceptor() { diff --git a/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionActivationTest.java b/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionActivationTest.java index 6b57c4b206..a7455b0c69 100644 --- a/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionActivationTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionActivationTest.java @@ -76,6 +76,7 @@ public class DurableSubscriptionActivationTest extends org.apache.activemq.TestS broker.setDestinations(new ActiveMQDestination[]{topic}); broker.start(); + broker.waitUntilStarted(); connection = createConnection(); } @@ -83,8 +84,10 @@ public class DurableSubscriptionActivationTest extends org.apache.activemq.TestS private void destroyBroker() throws Exception { if (connection != null) connection.close(); - if (broker != null) + if (broker != null) { broker.stop(); + broker.waitUntilStopped(); + } } public void testActivateWithExistingTopic1() throws Exception { @@ -121,6 +124,8 @@ public class DurableSubscriptionActivationTest extends org.apache.activemq.TestS // restart the broker restartBroker(); + Destination d1 = broker.getDestination(topic); + // activate session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); session.createDurableSubscriber(topic, "SubsId"); @@ -136,4 +141,5 @@ public class DurableSubscriptionActivationTest extends org.apache.activemq.TestS assertTrue("More than one consumer found: " + d.getConsumers().size(), d.getConsumers().size() == 1); } + }