Author: rob.stryker(a)jboss.com
Date: 2009-10-12 14:33:58 -0400 (Mon, 12 Oct 2009)
New Revision: 18047
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/IEventCodes.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
Log:
JBIDE-4925 - judging by API this should be fixed
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java 2009-10-12
16:50:14 UTC (rev 18046)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.java 2009-10-12
18:33:58 UTC (rev 18047)
@@ -80,6 +80,7 @@
public static String AddingJMXDeploymentFailed;
public static String JMXPauseScannerError;
public static String JMXResumeScannerError;
+ public static String JMXScannerCanceled;
public static String CannotSaveServersStartArgs;
static {
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties 2009-10-12
16:50:14 UTC (rev 18046)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties 2009-10-12
18:33:58 UTC (rev 18047)
@@ -61,3 +61,4 @@
AddingJMXDeploymentFailed=Error adding deployment folder to deployment scanner
JMXPauseScannerError=JBossTools was unable to pause the JBoss deployment scanner. For
optimal performance, verify your version includes an unsecured JMX RMI adaptor
JMXResumeScannerError=JBossTools was unable to resume the JBoss deployment scanner. For
optimal performance, verify your version includes an unsecured JMX RMI adaptor
+JMXScannerCanceled=JBossTools was unable to contact the JBoss deployment scanner in a
reasonable amount of time. This step has been skipped.
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/IEventCodes.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/IEventCodes.java 2009-10-12
16:50:14 UTC (rev 18046)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/IEventCodes.java 2009-10-12
18:33:58 UTC (rev 18047)
@@ -45,6 +45,7 @@
public static final int ADD_DEPLOYMENT_FOLDER = PUBLISHING_CODE | (4<<16);
public static final int SUSPEND_DEPLOYMENT_SCANNER = PUBLISHING_CODE | ISTATUS_CODE_WARN
| (5<<16);
public static final int RESUME_DEPLOYMENT_SCANNER = PUBLISHING_CODE | ISTATUS_CODE_WARN
| (6<<16);
+ public static final int DEPLOYMENT_SCANNER_TRANSITION_CANCELED = PUBLISHING_CODE |
ISTATUS_CODE_WARN | (7<<16);
// Publishing.JST
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2009-10-12
16:50:14 UTC (rev 18046)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2009-10-12
18:33:58 UTC (rev 18047)
@@ -185,13 +185,13 @@
}
- protected void publishStart(IProgressMonitor monitor) throws CoreException {
+ protected void publishStart(final IProgressMonitor monitor) throws CoreException {
super.publishStart(monitor);
if( shouldSuspendScanner()) {
JMXClassLoaderRepository.getDefault().addConcerned(getServer(), this);
IJMXRunnable r = new IJMXRunnable() {
public void run(MBeanServerConnection connection) throws Exception {
- suspendDeployment(connection);
+ suspendDeployment(connection, monitor);
}
};
try {
@@ -203,18 +203,18 @@
}
}
- protected void publishFinish(IProgressMonitor monitor) throws CoreException {
+ protected void publishFinish(final IProgressMonitor monitor) throws CoreException {
if( shouldSuspendScanner()) {
IJMXRunnable r = new IJMXRunnable() {
public void run(MBeanServerConnection connection) throws Exception {
- resumeDeployment(connection);
+ resumeDeployment(connection, monitor);
}
};
try {
JBossServerConnectionProvider.run(getServer(), r);
} catch( JMXException jmxe ) {
IStatus status = new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID,
IEventCodes.RESUME_DEPLOYMENT_SCANNER, Messages.JMXResumeScannerError, jmxe);
- ServerLogger.getDefault().log(getServer(), status);
+ ServerLogger.getDefault().log(getServer(), status);
} finally {
JMXClassLoaderRepository.getDefault().removeConcerned(getServer(), this);
}
@@ -230,15 +230,45 @@
return true;
}
- protected void suspendDeployment(MBeanServerConnection connection) throws Exception {
+ protected void suspendDeployment(final MBeanServerConnection connection,
IProgressMonitor monitor) throws Exception {
ObjectName name = new
ObjectName(IJBossRuntimeConstants.DEPLOYMENT_SCANNER_MBEAN_NAME);
- connection.invoke(name, IJBossRuntimeConstants.STOP, new Object[] { }, new String[]
{});
+ launchDeployCommand(connection, name, IJBossRuntimeConstants.STOP, monitor);
}
- protected void resumeDeployment(MBeanServerConnection connection) throws Exception {
+
+
+ protected void resumeDeployment(final MBeanServerConnection connection, IProgressMonitor
monitor) throws Exception {
ObjectName name = new
ObjectName(IJBossRuntimeConstants.DEPLOYMENT_SCANNER_MBEAN_NAME);
- connection.invoke(name, IJBossRuntimeConstants.START, new Object[] { }, new String[]
{});
+ launchDeployCommand(connection, name, IJBossRuntimeConstants.START, monitor);
}
+
+ protected void launchDeployCommand(final MBeanServerConnection connection, final
ObjectName objectName,
+ final String methodName, IProgressMonitor monitor) throws Exception {
+ final Exception[] e = new Exception[1];
+ Thread t = new Thread() {
+ public void run() {
+ try {
+ executeDeploymentCommand(connection, objectName, methodName);
+ } catch( Exception ex ) {
+ e[0] = ex;
+ }
+ }
+ };
+ t.start();
+ int count = 0;
+ while(t.isAlive() && !monitor.isCanceled() && count <= 4000) {
+ count+= 1000;
+ Thread.sleep(1000);
+ }
+ if( t.isAlive()) {
+ t.interrupt();
+ IStatus status = new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID,
IEventCodes.DEPLOYMENT_SCANNER_TRANSITION_CANCELED, Messages.JMXScannerCanceled, null);
+ ServerLogger.getDefault().log(getServer(), status);
+ }
+ }
+ protected void executeDeploymentCommand(MBeanServerConnection connection, ObjectName
objectName, String methodName) throws Exception {
+ connection.invoke(objectName, methodName, new Object[] { }, new String[] {});
+ }
}