Merge pull request #16 from pyr/master
authorFlorian Forster <github@nospam.verplant.org>
Wed, 18 Jan 2012 15:17:47 +0000 (07:17 -0800)
committerFlorian Forster <github@nospam.verplant.org>
Wed, 18 Jan 2012 15:17:47 +0000 (07:17 -0800)
GenericJMX plugin: Allow attribute to call operations.

bindings/java/org/collectd/java/GenericJMXConfValue.java

index 0eb0d5f..9fb0fc2 100644 (file)
@@ -312,7 +312,14 @@ class GenericJMXConfValue
 
     try
     {
-      value = conn.getAttribute (objName, key);
+      try
+      {
+        value = conn.getAttribute (objName, key);
+      }
+      catch (javax.management.AttributeNotFoundException e)
+      {
+        value = conn.invoke (objName, key, /* args = */ null, /* types = */ null);
+      }
     }
     catch (Exception e)
     {