You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2012/11/06 16:37:51 UTC

svn commit: r1406186 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java

Author: rajdavies
Date: Tue Nov  6 15:37:50 2012
New Revision: 1406186

URL: http://svn.apache.org/viewvc?rev=1406186&view=rev
Log:
Fix for https://issues.apache.org/jira/browse/AMQ-4161

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java?rev=1406186&r1=1406185&r2=1406186&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/plugin/StatisticsBroker.java Tue Nov  6 15:37:50 2012
@@ -22,7 +22,6 @@ import java.util.Set;
 
 import javax.jms.JMSException;
 import javax.management.ObjectName;
-
 import org.apache.activemq.advisory.AdvisorySupport;
 import org.apache.activemq.broker.Broker;
 import org.apache.activemq.broker.BrokerFilter;
@@ -58,6 +57,7 @@ public class StatisticsBroker extends Br
     static final String STATS_BROKER_PREFIX = "ActiveMQ.Statistics.Broker";
     static final String STATS_BROKER_RESET_HEADER = "ActiveMQ.Statistics.Broker.Reset";
     static final String STATS_SUBSCRIPTION_PREFIX = "ActiveMQ.Statistics.Subscription";
+    static final String STATS_DENOTE_END_LIST = STATS_DESTINATION_PREFIX + ".List.End.With.Null";
     private static final IdGenerator ID_GENERATOR = new IdGenerator();
     private final LongSequenceGenerator messageIdGenerator = new LongSequenceGenerator();
     protected final ProducerId advisoryProducerId = new ProducerId();
@@ -94,10 +94,13 @@ public class StatisticsBroker extends Br
             BrokerService brokerService = getBrokerService();
             RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker();
             if (destStats) {
-                String queueryName = physicalName.substring(STATS_DESTINATION_PREFIX.length(), physicalName.length());
-                ActiveMQDestination queryDest = ActiveMQDestination.createDestination(queueryName,msgDest.getDestinationType());
-                Set<Destination> set = getDestinations(queryDest);
-                for (Destination dest : set) {
+                String destinationName = physicalName.substring(STATS_DESTINATION_PREFIX.length(), physicalName.length());
+                String destinationQuery = destinationName.replace(STATS_DENOTE_END_LIST,"");
+                boolean endListMessage = !destinationName.equals(destinationQuery);
+                ActiveMQDestination queryDestination = ActiveMQDestination.createDestination(destinationQuery,msgDest.getDestinationType());
+                Set<Destination> destinations = getDestinations(queryDestination);
+
+                for (Destination dest : destinations) {
                     DestinationStatistics stats = dest.getDestinationStatistics();
                     if (stats != null) {
                         ActiveMQMapMessage statsMessage = new ActiveMQMapMessage();
@@ -121,6 +124,12 @@ public class StatisticsBroker extends Br
                         sendStats(producerExchange.getConnectionContext(), statsMessage, replyTo);
                     }
                 }
+                if(endListMessage){
+                    ActiveMQMapMessage statsMessage = new ActiveMQMapMessage();
+                    statsMessage.setJMSCorrelationID(messageSend.getCorrelationId());
+                    sendStats(producerExchange.getConnectionContext(),statsMessage,replyTo);
+                }
+
             } else if (subStats) {
                 sendSubStats(producerExchange.getConnectionContext(), getBrokerView().getQueueSubscribers(), replyTo);
                 sendSubStats(producerExchange.getConnectionContext(), getBrokerView().getTopicSubscribers(), replyTo);
@@ -250,4 +259,5 @@ public class StatisticsBroker extends Br
             context.setProducerFlowControl(originalFlowControl);
         }
     }
+
 }