From 614713629b0a3f06ab82524ed3d256cc66a4a5fa Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Fri, 5 Apr 2002 13:55:50 +0000 Subject: [PATCH] Make not so strong, we don't really know whether we've managed to end the spawned thread. Make the thread a daemon thread. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272238 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java index 50bbf4e1a..54c4cd537 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java @@ -139,6 +139,11 @@ public class ExecuteJava implements Runnable, TimeoutObserver { run(); } else { thread = new Thread(this, "ExecuteJava"); + // if we run into a timout, 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) { @@ -148,7 +153,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver { wait(); } catch (InterruptedException e) {} if (timedOut) { - project.log("Timeout: killed the sub-process", + project.log("Timeout: sub-process interrupted", Project.MSG_WARN); } else { thread = null;