< prev index next >

test/java/util/logging/LogManagerAppContextDeadlock.java

Print this page

        

*** 139,159 **** } }; t1.setDaemon(true); t1.start(); Thread t2 = new Thread() { public void run() { sem3.release(); try { // Wait until Thread1 is in FakeAppContext constructor sem2.acquire(); System.out.println("Sem2 acquired: Thread #1 will be waiting to acquire Sem"); } catch (InterruptedException ie) { Thread.interrupted(); } System.out.println("Logger.getLogger(name).info(name)"); ! Logger.getLogger(test.name());//.info(name); System.out.println("Done: Logger.getLogger(name).info(name)"); } }; t2.setDaemon(true); t2.start(); --- 139,163 ---- } }; t1.setDaemon(true); t1.start(); Thread t2 = new Thread() { + public Object logger; public void run() { sem3.release(); try { // Wait until Thread1 is in FakeAppContext constructor sem2.acquire(); System.out.println("Sem2 acquired: Thread #1 will be waiting to acquire Sem"); } catch (InterruptedException ie) { Thread.interrupted(); } System.out.println("Logger.getLogger(name).info(name)"); ! // stick the logger in an instance variable to prevent it ! // from being garbage collected before the main thread ! // calls LogManager.getLogger() below. ! logger = Logger.getLogger(test.name());//.info(name); System.out.println("Done: Logger.getLogger(name).info(name)"); } }; t2.setDaemon(true); t2.start();
< prev index next >