in taverna-server-webapp/src/main/java/org/apache/taverna/server/master/localworker/ForkRunFactory.java [239:283]
public void killFactory() {
if (factory != null) {
log.info("requesting shutdown of " + factoryProcessName);
try {
factory.shutdown();
sleep(700);
} catch (RemoteException e) {
log.warn(factoryProcessName + " failed to shut down nicely", e);
} catch (InterruptedException e) {
if (log.isDebugEnabled())
log.debug("interrupted during wait after asking "
+ factoryProcessName + " to shut down", e);
} finally {
factory = null;
}
}
if (factoryProcess != null) {
int code = -1;
try {
lastExitCode = code = factoryProcess.exitValue();
log.info(factoryProcessName + " already dead?");
} catch (RuntimeException e) {
log.info("trying to force death of " + factoryProcessName);
try {
factoryProcess.destroy();
sleep(350); // takes a little time, even normally
lastExitCode = code = factoryProcess.exitValue();
} catch (Exception e2) {
code = -1;
}
} finally {
factoryProcess = null;
stopLoggers();
}
if (code > 128) {
log.info(factoryProcessName + " died with signal="
+ (code - 128));
} else if (code >= 0) {
log.info(factoryProcessName + " process killed: code=" + code);
} else {
log.warn(factoryProcessName + " not yet dead");
}
}
}