Author: rob.stryker(a)jboss.com
Date: 2012-04-17 23:25:49 -0400 (Tue, 17 Apr 2012)
New Revision: 40264
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/JBossServerConnection.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/JBoss7ManagerServiceProxy.java
Log:
JBIDE-11064 for as7.1.0 remote, adds cleanup of threads where possible
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-04-18
01:32:40 UTC (rev 40263)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBoss71ServerConnection.java 2012-04-18
03:25:49 UTC (rev 40264)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.jmx.integration;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@@ -31,14 +32,17 @@
super(server);
}
- protected void initializeEnvironment(IServer s, String user, String pass) throws
CredentialException {
- // Do nothing
- }
-
public IConnectionProvider getProvider() {
return ExtensionManager.getProvider(JBoss71ConnectionProvider.PROVIDER_ID);
}
+ private String user;
+ private String pass;
+ protected void initializeEnvironment(IServer s, String user, String pass) throws
CredentialException {
+ this.user = user;
+ this.pass = pass;
+ }
+
protected MBeanServerConnection createConnection(IServer s) throws Exception {
ServerDelegate sd = (ServerDelegate)s.loadAdapter(ServerDelegate.class, null);
int port = -1;
@@ -50,9 +54,20 @@
String url = "service:jmx:remoting-jmx://" + s.getHost() + ":" +
port;
Map<String, String[]> environment = new HashMap<String, String[]>();
- JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(url),
environment);
- MBeanServerConnection connection = connector.getMBeanServerConnection();
- return connection;
+ environment.put(JMXConnector.CREDENTIALS, new String[]{user,pass});
+
+ JMXConnector connector = null;
+ try {
+ connector = JMXConnectorFactory.connect(new JMXServiceURL(url), environment);
+ MBeanServerConnection connection = connector.getMBeanServerConnection();
+ return connection;
+ } catch(IOException ioe) {
+ if( connector != null ) {
+ try {
+ connector.close();
+ } catch(Exception e) { /* Ignore */ }
+ }
+ return null;
+ }
}
-
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBossServerConnection.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBossServerConnection.java 2012-04-18
01:32:40 UTC (rev 40263)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBossServerConnection.java 2012-04-18
03:25:49 UTC (rev 40264)
@@ -191,26 +191,7 @@
protected void checkState() {
IDeployableServer jbs = ServerConverter.getDeployableServer(server);
if( server.getServerState() == IServer.STATE_STARTED && jbs != null &&
jbs.hasJMXProvider()) {
- try {
- run(new IJMXRunnable() {
- public void run(MBeanServerConnection connection)
- throws Exception {
- // Do nothing, just see if the connection worked
- }
- }, true);
- if( !isConnected ) {
- isConnected = true;
- ((AbstractJBossJMXConnectionProvider)getProvider()).fireChanged(JBossServerConnection.this);
- }
- } catch( Exception jmxe ) {
- IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error
connecting to jmx for server "+server.getName(), jmxe);
- ServerLogger.getDefault().log(server, status);
- // I thought i was connected but I'm not.
- if( isConnected ) {
- isConnected = false;
- ((AbstractJBossJMXConnectionProvider)getProvider()).fireChanged(JBossServerConnection.this);
- }
- }
+ connectToStartedServer();
} else {
root = null;
if( isConnected ) {
@@ -221,6 +202,28 @@
}
}
+ protected void connectToStartedServer() {
+ try {
+ run(new IJMXRunnable() {
+ public void run(MBeanServerConnection connection)
+ throws Exception {
+ // Do nothing, just see if the connection worked
+ }
+ }, true);
+ if( !isConnected ) {
+ isConnected = true;
+ ((AbstractJBossJMXConnectionProvider)getProvider()).fireChanged(JBossServerConnection.this);
+ }
+ } catch( Exception jmxe ) {
+ IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error connecting
to jmx for server "+server.getName(), jmxe);
+ ServerLogger.getDefault().log(server, status);
+ // I thought i was connected but I'm not.
+ if( isConnected ) {
+ isConnected = false;
+ ((AbstractJBossJMXConnectionProvider)getProvider()).fireChanged(JBossServerConnection.this);
+ }
+ }
+ }
/* *************
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/JBoss7ManagerServiceProxy.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/JBoss7ManagerServiceProxy.java 2012-04-18
01:32:40 UTC (rev 40263)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.management.core/src/org/jboss/ide/eclipse/as/management/core/JBoss7ManagerServiceProxy.java 2012-04-18
03:25:49 UTC (rev 40264)
@@ -88,6 +88,9 @@
}
public void dispose() {
+ IJBoss7ManagerService service = getService();
+ if( service != null )
+ service.dispose();
close();
}
Show replies by date