From: Florian Forster Date: Wed, 28 Oct 2009 12:31:06 +0000 (+0100) Subject: GenericJMX plugin: Close and re-open the connection upon I/O-errors. X-Git-Tag: collectd-4.8.2~7 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=91f44c9c9dbfa746fbe63b50c87fb8bf064d0daa;p=collectd.git GenericJMX plugin: Close and re-open the connection upon I/O-errors. --- diff --git a/bindings/java/org/collectd/java/GenericJMXConfConnection.java b/bindings/java/org/collectd/java/GenericJMXConfConnection.java index 7214fd76..ffa9ded4 100644 --- a/bindings/java/org/collectd/java/GenericJMXConfConnection.java +++ b/bindings/java/org/collectd/java/GenericJMXConfConnection.java @@ -208,7 +208,16 @@ private void connect () /* {{{ */ pd.setPlugin ("GenericJMX"); for (int i = 0; i < this._mbeans.size (); i++) - this._mbeans.get (i).query (this._jmx_connection, pd); + { + int status; + + status = this._mbeans.get (i).query (this._jmx_connection, pd); + if (status != 0) + { + this._jmx_connection = null; + return; + } + } /* for */ } /* }}} void query */ public String toString () diff --git a/bindings/java/org/collectd/java/GenericJMXConfMBean.java b/bindings/java/org/collectd/java/GenericJMXConfMBean.java index 27e9e329..1587bd5f 100644 --- a/bindings/java/org/collectd/java/GenericJMXConfMBean.java +++ b/bindings/java/org/collectd/java/GenericJMXConfMBean.java @@ -170,7 +170,7 @@ class GenericJMXConfMBean return (this._name); } /* }}} */ - public void query (MBeanServerConnection conn, PluginData pd) /* {{{ */ + public int query (MBeanServerConnection conn, PluginData pd) /* {{{ */ { Set names; Iterator iter; @@ -182,7 +182,7 @@ class GenericJMXConfMBean catch (Exception e) { Collectd.logError ("GenericJMXConfMBean: queryNames failed: " + e); - return; + return (-1); } if (names.size () == 0) @@ -236,6 +236,8 @@ class GenericJMXConfMBean for (int i = 0; i < this._values.size (); i++) this._values.get (i).query (conn, objName, pd_tmp); } + + return (0); } /* }}} void query */ }