activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r390998 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
Date Mon, 03 Apr 2006 10:44:03 GMT
Author: rajdavies
Date: Mon Apr  3 03:43:55 2006
New Revision: 390998

URL: http://svn.apache.org/viewcvs?rev=390998&view=rev
Log:
prevent ObjectNames being unregistered from the MBeanServer if already removed in doStop()

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java?rev=390998&r1=390997&r2=390998&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
Mon Apr  3 03:43:55 2006
@@ -22,7 +22,6 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.Map.Entry;
-
 import javax.management.InstanceNotFoundException;
 import javax.management.MBeanServer;
 import javax.management.MalformedObjectNameException;
@@ -34,7 +33,6 @@
 import javax.management.openmbean.TabularData;
 import javax.management.openmbean.TabularDataSupport;
 import javax.management.openmbean.TabularType;
-
 import org.apache.activemq.broker.Broker;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.ConnectionContext;
@@ -62,10 +60,8 @@
 import org.apache.activemq.util.SubscriptionKey;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
 import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArraySet;
-
 public class ManagedRegionBroker extends RegionBroker{
     private static final Log log=LogFactory.getLog(ManagedRegionBroker.class);
     private final MBeanServer mbeanServer;
@@ -163,11 +159,10 @@
         String name="";
         SubscriptionKey key=new SubscriptionKey(context.getClientId(),sub.getConsumerInfo().getSubcriptionName());
         if(sub.getConsumerInfo().isDurable()){
-            name = key.toString();
-        } else {
-            name = sub.getConsumerInfo().getConsumerId().toString();
+            name=key.toString();
+        }else{
+            name=sub.getConsumerInfo().getConsumerId().toString();
         }
-        
         try{
             ObjectName objectName=new ObjectName(brokerObjectName.getDomain()+":"+"BrokerName="+map.get("BrokerName")
                             +","+"Type=Subscription,"+"active=true,"+"name="+JMXSupport.encodeObjectNamePart(name)+"");
@@ -224,8 +219,9 @@
         queues.remove(key);
         temporaryQueues.remove(key);
         temporaryTopics.remove(key);
-        registeredMBeans.remove(key);
-        mbeanServer.unregisterMBean(key);
+        if(registeredMBeans.remove(key)){
+            mbeanServer.unregisterMBean(key);
+        }
     }
 
     protected void registerSubscription(ObjectName key,ConsumerInfo info,SubscriptionKey
subscriptionKey,
@@ -269,8 +265,9 @@
         inactiveDurableTopicSubscribers.remove(key);
         temporaryQueueSubscribers.remove(key);
         temporaryTopicSubscribers.remove(key);
-        registeredMBeans.remove(key);
-        mbeanServer.unregisterMBean(key);
+        if(registeredMBeans.remove(key)){
+            mbeanServer.unregisterMBean(key);
+        }
         DurableSubscriptionView view=(DurableSubscriptionView) durableTopicSubscribers.remove(key);
         if(view!=null){
             // need to put this back in the inactive list



Mime
View raw message