test/sun/misc/Cleaner/ExitOnThrow.java

Print this page

        

*** 26,48 **** import sun.misc.*; public class ExitOnThrow { - private static volatile boolean ran = false; - public static void main(String[] args) throws Exception { Cleaner.create(new Object(), new Runnable() { public void run() { - ran = true; throw new RuntimeException("Foo!"); } }); ! while (!ran) { System.gc(); Thread.sleep(100); } - System.exit(0); } } --- 26,44 ---- import sun.misc.*; public class ExitOnThrow { public static void main(String[] args) throws Exception { Cleaner.create(new Object(), new Runnable() { public void run() { throw new RuntimeException("Foo!"); } }); ! while (true) { System.gc(); Thread.sleep(100); } } }