modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml | 2
modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java | 33
++++++----
2 files changed, 24 insertions(+), 11 deletions(-)
New commits:
commit f523eb50cf96aa4f213acf38ffff2898321d7090
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Oct 26 11:55:25 2012 -0500
Correct parameter name to match execution code.
diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
index 50a24fa..1966ea3 100644
--- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
@@ -400,7 +400,7 @@
</operation>
<operation name="restoreSnapshot" description="Restore the
column family from a previously taken snapshot.">
<parameters>
- <c:simple-property name="name" required="true"
type="string" description="Snapshot Name">
+ <c:simple-property name="snapshotName" required="true"
type="string" description="Snapshot Name">
<c:option-source target="configuration"
expression="snapshots/snapshot=name"/>
</c:simple-property>
</parameters>
commit 4c9f26dc5301d3f3e4cd7ac128d496b5dfa2ae4c
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Oct 26 11:53:17 2012 -0500
Updating the JMX plugin to check if the connection is still open or valid before
returning the connection object. In case the connection is no longer valid, the code will
attempt to reconnect to the server.
The reconnection code was already used in the availability method. This change only
expands its usage.
diff --git a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java
b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java
index 1b6dd2c..e510c44 100644
--- a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java
+++ b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java
@@ -24,7 +24,6 @@ package org.rhq.plugins.jmx;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.mc4j.ems.connection.EmsConnection;
import org.mc4j.ems.connection.support.ConnectionProvider;
@@ -44,7 +43,7 @@ import org.rhq.plugins.jmx.util.ConnectionProviderFactory;
* versions. The same holds true for Hibernate applications - multiple connections can be
created
* to different versions of the Hibernate MBean and due to the isolation of each
connection, there
* are no version incompatibility errors that will occur.
- *
+ *
* @author Greg Hinkle
* @author John Mazzitelli
*/
@@ -106,18 +105,13 @@ public class JMXServerComponent<T extends
ResourceComponent<?>> implements JMXCo
}
public EmsConnection getEmsConnection() {
+ this.reconnectIfDisconnected();
+
return this.connection;
}
public AvailabilityType getAvailability() {
- if ((connectionProvider) == null || !connectionProvider.isConnected()) {
- try {
- internalStart();
- } catch (Exception e) {
- log.debug("Still unable to reconnect to " +
context.getResourceType() + "[" + context.getResourceKey()
- + "] due to error: " + e);
- }
- }
+ this.reconnectIfDisconnected();
return ((connectionProvider != null) && connectionProvider.isConnected())
? AvailabilityType.UP
: AvailabilityType.DOWN;
@@ -127,4 +121,23 @@ public class JMXServerComponent<T extends
ResourceComponent<?>> implements JMXCo
return this.context;
}
+ /**
+ * This method will attempt to reestablish the connection to the JMX server
+ * if it detects that the current connection is no longer open or valid.
+ *
+ * The code that detects if a connection is still open or valid is in the external
+ * EMS library and depends on the type of connection provider. Please read the EMS
+ * documentation and code for more details on how ConnectionProvider.isConnected()
+ * works for different supported providers.
+ */
+ private synchronized void reconnectIfDisconnected() {
+ if ((connectionProvider) == null || !connectionProvider.isConnected()) {
+ try {
+ internalStart();
+ } catch (Exception e) {
+ log.debug("Still unable to reconnect to " +
context.getResourceType() + "[" + context.getResourceKey()
+ + "] due to error: " + e);
+ }
+ }
+ }
}
\ No newline at end of file