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
This commit is contained in:
Robert Davies 2008-03-12 17:07:46 +00:00
parent 58cf400836
commit 22565e4176
1 changed files with 11 additions and 11 deletions

View File

@ -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());
}