ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 8510] - shutdown hook does not fire in forked java task under JDK1.4
Date Tue, 07 Dec 2004 17:25:34 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=8510>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=8510





------- Additional Comments From peterreilly@apache.org  2004-12-07 18:25 -------
I tested your example problem and saw the same thing under linux.
However, I then read Conor's report

"Note that the use of output or error streams to determine if the shutdown hook
has fired or not is suspect. The above file based approach is more conclusive."

So, I changed the code to do:
	public class Shutter extends Thread {
		public void run() {
//			log.debug("clean shutdown");
                    System.err.println("DEMO shutdown hook fired");
                    try {
                        java.io.PrintWriter pw
                            = new java.io.PrintWriter(
                      new java.io.FileOutputStream("test.txt"));
                        Thread.currentThread().sleep(3000);
                        pw.println("Test");
                        pw.close();
                    } catch (Exception e) {
                    }
                    System.err.flush();
                    System.out.println("clean shutdown...");
		}
	}

And noted that clean shutdown... was not seen, but the file was created
and written to, and the DEMO shutdown hook fired message was seen.
Can you make the above changes and see if they fix the problem?


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message