git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1129835 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2011-05-31 18:36:44 +00:00
parent 6fefadb620
commit 71c0d441f9
2 changed files with 30 additions and 13 deletions

View File

@ -348,6 +348,8 @@ public class ManagedRegionBroker extends RegionBroker {
} }
protected void registerProducer(ObjectName key, ActiveMQDestination dest, ProducerView view) throws Exception { protected void registerProducer(ObjectName key, ActiveMQDestination dest, ProducerView view) throws Exception {
if (dest != null) {
if (dest.isQueue()) { if (dest.isQueue()) {
if (dest.isTemporary()) { if (dest.isTemporary()) {
temporaryQueueProducers.put(key, view); temporaryQueueProducers.put(key, view);
@ -361,6 +363,8 @@ public class ManagedRegionBroker extends RegionBroker {
topicProducers.put(key, view); topicProducers.put(key, view);
} }
} }
}
try { try {
AnnotatedMBean.registerMBean(managementContext, view, key); AnnotatedMBean.registerMBean(managementContext, view, key);
registeredMBeans.add(key); registeredMBeans.add(key);
@ -499,7 +503,7 @@ public class ManagedRegionBroker extends RegionBroker {
} }
protected void addInactiveSubscription(SubscriptionKey key, SubscriptionInfo info) { protected void addInactiveSubscription(SubscriptionKey key, SubscriptionInfo info) {
Hashtable map = brokerObjectName.getKeyPropertyList(); Hashtable<String, String> map = brokerObjectName.getKeyPropertyList();
try { try {
ObjectName objectName = new ObjectName(brokerObjectName.getDomain() + ":" + "BrokerName=" + map.get("BrokerName") + "," + "Type=Subscription," + "active=false," ObjectName objectName = new ObjectName(brokerObjectName.getDomain() + ":" + "BrokerName=" + map.get("BrokerName") + "," + "Type=Subscription," + "active=false,"
+ "name=" + JMXSupport.encodeObjectNamePart(key.toString()) + ""); + "name=" + JMXSupport.encodeObjectNamePart(key.toString()) + "");
@ -671,8 +675,17 @@ public class ManagedRegionBroker extends RegionBroker {
// Build the object name for the producer info // Build the object name for the producer info
Hashtable map = brokerObjectName.getKeyPropertyList(); Hashtable map = brokerObjectName.getKeyPropertyList();
String destinationType = "destinationType=" + producerInfo.getDestination().getDestinationTypeAsString(); String destinationType = "destinationType=";
String destinationName = "destinationName=" + JMXSupport.encodeObjectNamePart(producerInfo.getDestination().getPhysicalName()); 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 clientId = "clientId=" + JMXSupport.encodeObjectNamePart(connectionClientId);
String producerId = "producerId=" + JMXSupport.encodeObjectNamePart(producerInfo.getProducerId().toString()); String producerId = "producerId=" + JMXSupport.encodeObjectNamePart(producerInfo.getProducerId().toString());

View File

@ -613,6 +613,10 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
assertEquals("topic1 Producer count", 0, topic1.getProducerCount()); assertEquals("topic1 Producer count", 0, topic1.getProducerCount());
assertEquals("topic2 Producer count", 0, topic2.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); assertEquals("broker Topic Producer count", 0, broker.getTopicProducers().length);
} }