Skip to content
Browse files

[388030] Restart server doesn't finish

  • Loading branch information...
1 parent 0899160 commit d2dc2b54198f65f4942ad02260a45b1df88cc711 @elsony elsony committed Sep 7, 2012
View
25 ...s/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Server.java
@@ -375,11 +375,18 @@ protected IStatus run(IProgressMonitor monitor) {
public RestartJob(String launchMode) {
super(NLS.bind(Messages.jobRestarting, Server.this.getName()));
this.launchMode = launchMode;
- setRule(Server.this);
}
protected IStatus run(IProgressMonitor monitor) {
- return restartImpl(launchMode, monitor);
+ try{
+ // Do begin rule in here instead of setRule on constructor to prevent deadlock
+ // on the default restart operation during the join() in the StartJob.
+ Job.getJobManager().beginRule(Server.this, monitor);
+ return restartImpl(launchMode, monitor);
+ }
+ finally{
+ Job.getJobManager().endRule(Server.this);
+ }
}
}
@@ -3164,8 +3171,18 @@ protected IStatus restartImpl(String launchMode, IProgressMonitor monitor) {
// if restart is not implemented by the server adopter
// lets provide a default implementation
stop(false);
- start(launchMode, monitor);
-
+ ISchedulingRule curRule = null;
+ try {
+ if (((ServerType)getServerType()).synchronousStart()) {
+ curRule = Job.getJobManager().currentRule();
+ Job.getJobManager().endRule(curRule);
+ }
+ start(launchMode, monitor);
+ } finally {
+ if (curRule != null) {
+ Job.getJobManager().beginRule(curRule, monitor);
+ }
+ }
} catch (Exception e) {
if (Trace.SEVERE) {
Trace.trace(Trace.STRING_SEVERE, "Error restarting server", e);

0 comments on commit d2dc2b5

Please sign in to comment.
Something went wrong with that request. Please try again.