[jbosstools-commits] JBoss Tools SVN: r44027 - trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Wed Sep 26 05:57:23 EDT 2012
Author: rob.stryker at jboss.com
Date: 2012-09-26 05:57:22 -0400 (Wed, 26 Sep 2012)
New Revision: 44027
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBoss71ServerConnection.java
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JMXProvider.java
Log:
JBIDE-12181 to trunk
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBoss71ServerConnection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBoss71ServerConnection.java 2012-09-26 09:47:03 UTC (rev 44026)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBoss71ServerConnection.java 2012-09-26 09:57:22 UTC (rev 44027)
@@ -11,7 +11,9 @@
package org.jboss.ide.eclipse.as.jmx.integration;
import java.io.IOException;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import javax.management.MBeanServerConnection;
@@ -46,7 +48,8 @@
protected void initializeEnvironment(IServer s, String user, String pass) throws CredentialException {
this.user = user;
this.pass = pass;
- this.connectionToConnector = new HashMap<MBeanServerConnection, JMXConnector>();
+ if( this.connectionToConnector == null )
+ this.connectionToConnector = new HashMap<MBeanServerConnection, JMXConnector>();
}
protected MBeanServerConnection createConnection(IServer s) throws Exception {
@@ -81,17 +84,25 @@
protected void cleanupConnection(IServer server, MBeanServerConnection connection) {
super.cleanupConnection(server, connection);
- JMXConnector connector = null;
- synchronized(this) {
- connector = connectionToConnector.get(connection);
- if( connector != null ) {
- connectionToConnector.remove(connection);
+ }
+ protected void checkState(IServer server) {
+ super.checkState(server);
+ if( connectionToConnector != null && !isConnected() ) {
+ closeAllConnections();
+ }
+ }
+ private void closeAllConnections() {
+ Collection<JMXConnector> c = connectionToConnector.values();
+ Iterator<JMXConnector> i = c.iterator();
+ while(i.hasNext()) {
+ JMXConnector jmxc = i.next();
+ // Same logic here as in AS71Manager, because the close can block for 10+ minutes
+ if( jmxc != null ) {
+ closeClientJoin(jmxc);
}
}
-
- // Same logic here as in AS71Manager, because the close can block for 10+ minutes
- if( connector != null ) {
- closeClientJoin(connector);
+ synchronized(this) {
+ connectionToConnector.clear();
}
}
@@ -116,5 +127,4 @@
t.interrupt();
}
}
-
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JMXProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JMXProvider.java 2012-09-26 09:47:03 UTC (rev 44026)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JMXProvider.java 2012-09-26 09:57:22 UTC (rev 44027)
@@ -140,7 +140,7 @@
server.loadAdapter(JBossServer.class, new NullProgressMonitor()) != null
&& server.getServerState() == IServer.STATE_STARTED);
IConnectionWrapper connection = JBossJMXConnectionProviderModel.getDefault().getConnection(server);
- return preconditions && connection.isConnected();
+ return preconditions && connection != null && connection.isConnected();
}
public synchronized void selectionChanged(IStructuredSelection sel) {
More information about the jbosstools-commits
mailing list