activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r1415594 - in /activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx: StatusView.java StatusViewMBean.java
Date Fri, 30 Nov 2012 12:21:21 GMT
Author: jstrachan
Date: Fri Nov 30 12:21:21 2012
New Revision: 1415594

URL: http://svn.apache.org/viewvc?rev=1415594&view=rev
Log:
added a more jolokia friendly statusList() method which returns nicer JSON for the status
query

Modified:
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/StatusView.java
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/StatusViewMBean.java

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/StatusView.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/StatusView.java?rev=1415594&r1=1415593&r2=1415594&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/StatusView.java
(original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/StatusView.java
Fri Nov 30 12:21:21 2012
@@ -22,6 +22,8 @@ import javax.management.openmbean.Compos
 import javax.management.openmbean.TabularData;
 import javax.management.openmbean.TabularDataSupport;
 import javax.management.openmbean.TabularType;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 public class StatusView implements StatusViewMBean {
@@ -39,14 +41,24 @@ public class StatusView implements Statu
         TabularType tt = new TabularType("Status", "Status", ct, new String[]{"id", "resource"});
         TabularDataSupport rc = new TabularDataSupport(tt);
 
+        List<StatusEvent> list = statusList();
+        for (StatusEvent statusEvent : list) {
+            rc.put(new CompositeDataSupport(ct, factory.getFields(statusEvent)));
+        }
+        return rc;
+    }
+
+    @Override
+    public List<StatusEvent> statusList() throws Exception {
+        List<StatusEvent> answer = new ArrayList<StatusEvent>();
         Map<ObjectName, DestinationView> queueViews = broker.getQueueViews();
         for (Map.Entry<ObjectName, DestinationView> entry : queueViews.entrySet())
{
             DestinationView queue = entry.getValue();
             if (queue.getConsumerCount() == 0 && queue.getProducerCount() > 0)
{
-                rc.put(new CompositeDataSupport(ct, factory.getFields(new StatusEvent("AMQ-NoConsumer",
entry.getKey().toString()))));
+                answer.add(new StatusEvent("AMQ-NoConsumer", entry.getKey().toString()));
             }
         }
-        return rc;
+        return answer;
     }
 
 }

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/StatusViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/StatusViewMBean.java?rev=1415594&r1=1415593&r2=1415594&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/StatusViewMBean.java
(original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/StatusViewMBean.java
Fri Nov 30 12:21:21 2012
@@ -17,8 +17,21 @@
 package org.apache.activemq.broker.jmx;
 
 import javax.management.openmbean.TabularData;
+import java.util.List;
 
+/**
+ * Returns the status events of the broker to indicate any warnings.
+ */
 public interface StatusViewMBean {
 
     public TabularData status() throws Exception;
+
+    /**
+     * Warning this method can only be invoked if you have the correct version
+     * of {@link StatusEvent} on your classpath or you use something
+     * like <a href="http://jolokia.org/">jolokia</a> to access JMX.
+     *
+     * If in doubt, please use the {@link #status()} method instead!
+     */
+    List<StatusEvent> statusList() throws Exception;
 }



Mime
View raw message