Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 847DC4695 for ; Tue, 31 May 2011 18:37:08 +0000 (UTC) Received: (qmail 447 invoked by uid 500); 31 May 2011 18:37:08 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 420 invoked by uid 500); 31 May 2011 18:37:08 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 413 invoked by uid 99); 31 May 2011 18:37:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2011 18:37:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2011 18:37:05 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9435F23889B2; Tue, 31 May 2011 18:36:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110531183644.9435F23889B2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 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); }