From e66967bff1fb539b3210baacf40f800a345d7288 Mon Sep 17 00:00:00 2001 From: Bosanac Dejan Date: Wed, 11 Jul 2012 09:28:19 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-2665 - regression, keepDurableSubsActive is not properly propagated to the durable subscription leading to increasing consumer list git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1360085 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/activemq/broker/region/RegionBroker.java | 2 +- .../usecases/DurableSubscriptionActivationTest.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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); } + }