/** * Create the Watchdog to kill a runaway process. * * @return instance of ExecuteWatchdog. * * @throws BuildException under unknown circumstances. */ protected ExecuteWatchdog createWatchdog() throws BuildException { return (timeout == null) ? null : new ExecuteWatchdog(timeout); }
/** * Test for an untimely death of the process. * * @return true if a watchdog had to kill the process. * @since Ant 1.5 */ public boolean killedProcess() { return watchdog != null && watchdog.killedProcess(); }
/** * Stops the watcher. It will notify all threads possibly waiting * on this object. */ public synchronized void stop() { watchdog.stop(); cleanUp(); }
watchdog.start(process); watchdog.stop(); watchdog.checkException();
/** * Create the Watchdog to kill a runaway process. * * @return new watchdog. * * @throws BuildException under unknown circumstances. * * @since Ant 1.5 */ protected ExecuteWatchdog createWatchdog() throws BuildException { if (timeout == null) { return null; } return new ExecuteWatchdog(timeout); }
int exitValue= executeAsForked(cmd, watchdog); if(null != watchdog) { wasKilled= watchdog.killedProcess();
/** * 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(); } }
/** * @return <tt>null</tt> if there is no timeout value, otherwise the * watchdog instance. * * @throws BuildException under unspecified circumstances * @since Ant 1.2 */ protected ExecuteWatchdog createWatchdog() /*throws BuildException*/ { if(m_timeout == null) { return null; } return new ExecuteWatchdog(m_timeout.longValue()); }
int exitValue = executeAsForked(cmd, watchdog); if (null != watchdog) { wasKilled = watchdog.killedProcess();
/** * @return <tt>null</tt> if there is no timeout value, otherwise the watchdog instance. * @throws BuildException under unspecified circumstances * @since Ant 1.2 */ protected ExecuteWatchdog createWatchdog() /*throws BuildException*/ { if (m_timeout == null) { return null; } return new ExecuteWatchdog(m_timeout.longValue()); }
final boolean crash = (watchdog != null && watchdog.killedProcess()) || !Constants.TERMINATED_SUCCESSFULLY.equals(vmCrashString); if (watchdog != null && watchdog.killedProcess()) { result.timedOut = true; logTimeout(feArray, test, vmCrashString);
timeout == null ? null : new ExecuteWatchdog(timeout)); exe.setAntRun(pc.getProject()); if (Os.isFamily("openvms")) {
private ExecuteWatchdog createWatchdog() { ExecuteWatchdog watchdog = (_timeOut > 0L) ? new ExecuteWatchdog(_timeOut) : null; return watchdog; }
/** * @return <tt>null</tt> if there is a timeout value, otherwise the * watchdog instance. * * @throws BuildException under unspecified circumstances * @since Ant 1.2 */ protected ExecuteWatchdog createWatchdog() throws BuildException { if (timeout == null) { return null; } return new ExecuteWatchdog((long) timeout); }
public void execute(String command, List<String> args, InputStream in, OutputStream out) throws Exception { List<String> cmdLine = new ArrayList<String>(); if (isWindows()) { cmdLine.add("cmd.exe"); cmdLine.add("/c"); } cmdLine.add(resolveCommandForOS(command)); // add command-specific arguments cmdLine.addAll(getCommandArguments(command)); // add user arguments if (args != null) { cmdLine.addAll(args); } ExecuteWatchdog watchdog = new ExecuteWatchdog( timeout ); ExecuteStreamHandler streamHandler = new PumpStreamHandler( out, out, in ); Execute exec = new Execute( streamHandler, watchdog ); exec.setCommandline( cmdLine.toArray(new String[] {}) ); List<String> env = getCommandEnvironment(command); if (!env.isEmpty()) { exec.setEnvironment(env.toArray(new String[] {}) ); } exec.execute(); }
timeout == null ? null : new ExecuteWatchdog(timeout.longValue())); exe.setAntRun(pc.getProject());