blob: e6653f69cf01e4a1ab94feebadcccb18b26574e4 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.wst.server.core.internal;
import org.eclipse.core.runtime.*;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.internal.ServerSchedulingRule;
/**
* A job for stopping the server.
*
* Note: This is a backport for bug 200715. It is not API compatible with the
* WTP 3.0 version due to missing translated strings.
*/
public class StopServerJob extends ChainedJob {
public StopServerJob(IServer server, String name) {
super(name, server);
setRule(new ServerSchedulingRule(server));
}
/* (non-Javadoc)
* @see org.eclipse.core.internal.jobs.InternalJob#run(org.eclipse.core.runtime.IProgressMonitor)
*/
protected IStatus run(IProgressMonitor monitor) {
final IStatus[] status = new IStatus[1];
getServer().stop(false, new IServer.IOperationListener() {
public void done(IStatus result) {
status[0] = result;
}
});
while (status[0] == null & !monitor.isCanceled()) {
try {
Thread.sleep(200);
} catch (Exception e) {
// ignore
}
}
return status[0];
}
}