activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1129835 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java test/java/org/apache/activemq/broker/jmx/MBeanTest.java
Date Tue, 31 May 2011 18:36:44 GMT
Author: tabish
Date: Tue May 31 18:36:44 2011
New Revision: 1129835

URL: http://svn.apache.org/viewvc?rev=1129835&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQ-3337

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

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java?rev=1129835&r1=1129834&r2=1129835&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedRegionBroker.java
Tue May 31 18:36:44 2011
@@ -348,19 +348,23 @@ public class ManagedRegionBroker extends
     }
 
     protected void registerProducer(ObjectName key, ActiveMQDestination dest, ProducerView
view) throws Exception {
-        if (dest.isQueue()) {
-            if (dest.isTemporary()) {
-                temporaryQueueProducers.put(key, view);
-            } else {
-                queueProducers.put(key, view);
-            }
-        } else {
-            if (dest.isTemporary()) {
-                temporaryTopicProducers.put(key, view);
+
+        if (dest != null) {
+            if (dest.isQueue()) {
+                if (dest.isTemporary()) {
+                    temporaryQueueProducers.put(key, view);
+                } else {
+                    queueProducers.put(key, view);
+                }
             } else {
-                topicProducers.put(key, view);
+                if (dest.isTemporary()) {
+                    temporaryTopicProducers.put(key, view);
+                } else {
+                    topicProducers.put(key, view);
+                }
             }
         }
+
         try {
             AnnotatedMBean.registerMBean(managementContext, view, key);
             registeredMBeans.add(key);
@@ -499,7 +503,7 @@ public class ManagedRegionBroker extends
     }
 
     protected void addInactiveSubscription(SubscriptionKey key, SubscriptionInfo info) {
-        Hashtable map = brokerObjectName.getKeyPropertyList();
+        Hashtable<String, String> map = brokerObjectName.getKeyPropertyList();
         try {
             ObjectName objectName = new ObjectName(brokerObjectName.getDomain() + ":" + "BrokerName="
+ map.get("BrokerName") + "," + "Type=Subscription," + "active=false,"
                                                    + "name=" + JMXSupport.encodeObjectNamePart(key.toString())
+ "");
@@ -671,8 +675,17 @@ public class ManagedRegionBroker extends
         // Build the object name for the producer info
         Hashtable map = brokerObjectName.getKeyPropertyList();
 
-        String destinationType = "destinationType=" + producerInfo.getDestination().getDestinationTypeAsString();
-        String destinationName = "destinationName=" + JMXSupport.encodeObjectNamePart(producerInfo.getDestination().getPhysicalName());
+        String destinationType = "destinationType=";
+        String destinationName = "destinationName=";
+
+        if (producerInfo.getDestination() == null) {
+            destinationType += "NOTSET";
+            destinationName += "NOTSET";
+        } else {
+            destinationType += producerInfo.getDestination().getDestinationTypeAsString();
+            destinationName += JMXSupport.encodeObjectNamePart(producerInfo.getDestination().getPhysicalName());
+        }
+
         String clientId = "clientId=" + JMXSupport.encodeObjectNamePart(connectionClientId);
         String producerId = "producerId=" + JMXSupport.encodeObjectNamePart(producerInfo.getProducerId().toString());
 

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java?rev=1129835&r1=1129834&r2=1129835&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
Tue May 31 18:36:44 2011
@@ -613,6 +613,10 @@ public class MBeanTest extends EmbeddedB
         assertEquals("topic1 Producer count", 0, topic1.getProducerCount());
         assertEquals("topic2 Producer count", 0, topic2.getProducerCount());
 
+        MessageProducer producer4 = session.createProducer(null);
+        producer4.close();
+        Thread.sleep(500);
+
         assertEquals("broker Topic Producer count", 0, broker.getTopicProducers().length);
     }
 



Mime
View raw message