From 22565e4176967ae998a49ff4958e877f33b443aa Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Wed, 12 Mar 2008 17:07:46 +0000 Subject: [PATCH] don't throw an exception if removing an invalid subscription - it could happen from the ConnectionSplitBroker git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@636422 13f79535-47bb-0310-9956-ffa450edef68 --- .../broker/region/AbstractRegion.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java b/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java index 77caa721a8..6badd7b593 100755 --- a/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java @@ -294,18 +294,18 @@ public abstract class AbstractRegion implements Region { LOG.debug("Removing consumer: " + info.getConsumerId()); Subscription sub = subscriptions.remove(info.getConsumerId()); - if (sub == null) { - throw new IllegalArgumentException("The subscription does not exist: " + info.getConsumerId()); + //The sub could be removed elsewhere - see ConnectionSplitBroker + if (sub != null) { + + // remove the subscription from all the matching queues. + for (Iterator iter = destinationMap.get(info.getDestination()) + .iterator(); iter.hasNext();) { + Destination dest = (Destination) iter.next(); + dest.removeSubscription(context, sub); + } + + destroySubscription(sub); } - - // remove the subscription from all the matching queues. - for (Iterator iter = destinationMap.get(info.getDestination()).iterator(); iter.hasNext();) { - Destination dest = (Destination)iter.next(); - dest.removeSubscription(context, sub); - } - - destroySubscription(sub); - synchronized (consumerChangeMutexMap) { consumerChangeMutexMap.remove(info.getConsumerId()); }