// if we run into a timeout, the run-away thread shall not
// make the VM run forever - if no timeout occurs, Ant's
// main thread will still be there to let the new thread
// finish
thread.setDaemon(true);
Watchdog w = new Watchdog(timeout.longValue());
w.addTimeoutObserver(this);
synchronized (this) {
thread.start();
w.start();
try {
wait();
} catch (InterruptedException e) {
// ignore
}
if (timedOut) {
project.log("Timeout: sub-process interrupted",
Project.MSG_WARN);
} else {
thread = null;
w.stop();
}
}
}
if (caught != null) {
throw caught;