From: Pierre-Yves Ritschard Date: Wed, 18 Jan 2012 12:57:11 +0000 (+0100) Subject: Allow `Attribute` to query an MBean operation X-Git-Tag: collectd-5.1.0~46^2~2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ed4e3a66c88dca6f8f675bb37931bb785a10cdd2;p=collectd.git Allow `Attribute` to query an MBean operation MBeans provide two entities to the outside world: * Attributes * Operations The former is a simple key/value lookup, while the latter triggers a method call and yields the result. Operations have signatures, they can be fed an array of parameters. For now, calls are triggered assuming there are no parameters. Later a separate keyword `Operation` can be introduced, taking a list of `Parameter` directives specifying type and values to feed to the MBean operation. --- diff --git a/bindings/java/org/collectd/java/GenericJMXConfValue.java b/bindings/java/org/collectd/java/GenericJMXConfValue.java index 0eb0d5f8..0ed19908 100644 --- a/bindings/java/org/collectd/java/GenericJMXConfValue.java +++ b/bindings/java/org/collectd/java/GenericJMXConfValue.java @@ -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, null, null); + } } catch (Exception e) {