From ed4e3a66c88dca6f8f675bb37931bb785a10cdd2 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Ritschard Date: Wed, 18 Jan 2012 13:57:11 +0100 Subject: [PATCH] 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. --- bindings/java/org/collectd/java/GenericJMXConfValue.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) { -- 2.30.2