[231956] Canceling start doesn't actually stop starting
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
index e8b3eff..b4fc04a 100644
--- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
+++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
@@ -579,7 +579,11 @@
public void setServerState(int state) {
if (state == serverState)
return;
-
+
+ // ensure that any server monitors are started
+ if (state == IServer.STATE_STARTED)
+ ServerMonitorManager.getInstance();
+
this.serverState = state;
fireServerStateChangeEvent();
}
@@ -2214,7 +2218,7 @@
try {
getBehaviourDelegate(null).startModule(module, null);
} catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate restartModule() " + toString(), e);
+ Trace.trace(Trace.SEVERE, "Error calling delegate startModule() " + toString(), e);
}
}
@@ -2227,7 +2231,7 @@
try {
getBehaviourDelegate(null).stopModule(module, null);
} catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate restartModule() " + toString(), e);
+ Trace.trace(Trace.SEVERE, "Error calling delegate stopModule() " + toString(), e);
}
}
@@ -2679,7 +2683,7 @@
if (totalTimeout < 0)
totalTimeout = 1;
boolean userCancelled = false;
- int retryPeriod = 2500;
+ int retryPeriod = 1000;
while (!notified[0] && totalTimeout > 0 && !userCancelled && !timer.alreadyDone) {
Thread.sleep(retryPeriod);
if (serverTimeout > 0)
@@ -2687,7 +2691,8 @@
if (!notified[0] && !timer.alreadyDone && monitor2.isCanceled()) {
// user canceled - set the server state to stopped
userCancelled = true;
- setServerState(IServer.STATE_STOPPED);
+ if (launch != null && !launch.isTerminated())
+ launch.terminate();
// notify waiter
synchronized (notified) {
Trace.trace(Trace.FINEST, "synchronousStart user cancelled");
@@ -2751,7 +2756,7 @@
return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorStartTimeout, new String[] { getName(), (serverTimeout / 1000) + "" }), null);
}
- if (getServerState() == IServer.STATE_STOPPED)
+ if (!monitor.isCanceled() && getServerState() == IServer.STATE_STOPPED)
return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorStartFailed, getName()), null);
Trace.trace(Trace.FINEST, "synchronousStart 4");
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java
index 35b8265..6304836 100644
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java
+++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java
@@ -751,7 +751,7 @@
// TODO - multiple module artifacts
IModuleArtifact[] moduleArtifacts = ServerPlugin.getModuleArtifacts(globalSelection);
IModuleArtifact moduleArtifact = null;
- if (moduleArtifacts != null)
+ if (moduleArtifacts != null && moduleArtifacts.length > 0)
moduleArtifact = moduleArtifacts[0];
IModule module = null;