Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Properly handle JMX TabularData.

Change-Id: I3e27bbf6a4003f21fd78c40f086e3177b4293598
  • Loading branch information...
commit a9763c550d62121da584d13f55a5941446e3c4dd 1 parent 4347116
@tsuna tsuna authored
View
BIN  collectors/lib/jmx-1.0.jar
Binary file not shown
View
20 stumbleupon/monitoring/jmx.java
@@ -32,6 +32,7 @@
import javax.management.MBeanInfo;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
+import javax.management.openmbean.TabularData;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
@@ -209,9 +210,26 @@ private static void dumpMBean(final boolean long_output,
final MBeanServerConnection mbsc,
final ObjectName object,
final MBeanAttributeInfo attr) throws Exception {
- final StringBuilder buf = new StringBuilder();
final String name = attr.getName();
Object value = mbsc.getAttribute(object, name);
+ if (value instanceof TabularData) {
+ final TabularData tab = (TabularData) value;
+ int i = 0;
+ for (final Object o : tab.keySet()) {
+ dumpMBeanValue(long_output, print_timestamps, object, name + "." + i, o);
+ i++;
+ }
+ } else {
+ dumpMBeanValue(long_output, print_timestamps, object, name, value);
+ }
+ }
+
+ private static void dumpMBeanValue(final boolean long_output,
+ final boolean print_timestamps,
+ final ObjectName object,
+ final String name,
+ final Object value) {
+ final StringBuilder buf = new StringBuilder();
final long timestamp = System.currentTimeMillis() / 1000;
if (print_timestamps) {
buf.append(timestamp).append('\t');

0 comments on commit a9763c5

Please sign in to comment.
Something went wrong with that request. Please try again.