/** * Stops the watcher. It will notify all threads possibly waiting * on this object. */ public synchronized void stop() { watchdog.stop(); cleanUp(); }
/** * Called after watchdog has finished. * This can be called in the watchdog thread * @param w the watchdog */ @Override public synchronized void timeoutOccured(Watchdog w) { try { try { // We must check if the process was not stopped // before being here process.exitValue(); } catch (IllegalThreadStateException itse) { // the process is not terminated, if this is really // a timeout and not a manual stop then kill it. if (watch) { killedProcess = true; process.destroy(); } } } catch (Exception e) { caught = e; } finally { cleanUp(); } }