8150533: Test java/util/logging/LogManagerAppContextDeadlock.java times out intermittently.
Summary: This is a test bug caused by a Logger being garbage collected too early.
Reviewed-by: darcy
--- a/jdk/test/java/util/logging/LogManagerAppContextDeadlock.java Fri Feb 26 06:03:12 2016 +0100
+++ b/jdk/test/java/util/logging/LogManagerAppContextDeadlock.java Fri Feb 26 12:11:28 2016 +0100
@@ -141,6 +141,7 @@
t1.setDaemon(true);
t1.start();
Thread t2 = new Thread() {
+ public Object logger;
public void run() {
sem3.release();
try {
@@ -151,7 +152,10 @@
Thread.interrupted();
}
System.out.println("Logger.getLogger(name).info(name)");
- Logger.getLogger(test.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)");
}
};