|
From: Andres M. <amo...@us...> - 2006-12-11 20:53:53
|
Update of /cvsroot/fieldling/Fieldling/src/fieldling/quilldriver/task In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv13548/src/fieldling/quilldriver/task Modified Files: ExitQD.java Log Message: For some unexplained reason, in my development box (win xp, sp2) system.exit does not kill all of the java threads, leading to memory leaks after starting several instances of quilldriver. Now I am forcing the vm to halt if the normal system.exit does not kill all threads in 10 seconds. Index: ExitQD.java =================================================================== RCS file: /cvsroot/fieldling/Fieldling/src/fieldling/quilldriver/task/ExitQD.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExitQD.java 2 Jun 2006 15:01:28 -0000 1.1 --- ExitQD.java 11 Dec 2006 20:53:51 -0000 1.2 *************** *** 15,18 **** --- 15,31 ---- return; //user cancelled close } + /* It is not shutting down under certain conditions in windows xp. + * This makes sure VM does finish, with a grace period of 10 sec. + */ + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + try { + Thread.sleep(10000); + } catch(InterruptedException ex) {} + // halt will bail out without calling further shutdown hooks or + // finalizers + Runtime.getRuntime().halt(1); + } + }); System.exit(0); } |