< prev index next >

test/jdk/java/util/logging/LogManager/TestLoggerNames.java

Print this page

        

@@ -29,15 +29,16 @@
 import java.util.concurrent.Phaser;
 import java.util.concurrent.Semaphore;
 import java.util.logging.Handler;
 import java.util.logging.LogManager;
 import java.util.logging.Logger;
+import java.lang.ref.Reference;
 
 
 /**
  * @test
- * @bug 7113878
+ * @bug 7113878 8222027
  * @summary This is not a test that will check that 7113878 is fixed, but
  *          rather a test that will invoke the modified code & try to verify
  *          that fixing 7113878 has not introduced some big regression.
  *          This test should pass, whether 7113878 is there or not.
  * @run main/othervm TestLoggerNames

@@ -131,11 +132,12 @@
         System.out.println("Got all expected logger names");
     }
 
 
     public static void main(String[] args) throws InterruptedException {
-        LogManager.getLogManager().addLogger(new TestLogger("com.foo.bar.zzz", null));
+        TestLogger tl = new TestLogger("com.foo.bar.zzz", null);
+        LogManager.getLogManager().addLogger(tl);
         try {
             Logger.getLogger(null);
             throw new RuntimeException("Logger.getLogger(null) didn't throw expected NPE");
         } catch (NullPointerException x) {
             System.out.println("Got expected NullPointerException for Logger.getLogger(null)");

@@ -143,10 +145,11 @@
         List<Logger> loggers = new CopyOnWriteArrayList<>();
         loggers.add(Logger.getLogger("one.two.addMeAChild"));
         loggers.add(Logger.getLogger("aaa.bbb.replaceMe"));
         loggers.add(Logger.getLogger("bbb.aaa.addMeAChild"));
         TestLogger test = (TestLogger)Logger.getLogger("com.foo.bar.zzz");
+        Reference.reachabilityFence(tl);
         loggers.add(Logger.getLogger("ddd.aaa.addMeAChild"));
 
         checkLoggerNames(loggers);
 
         Thread loggerNamesThread = new Thread(() -> {
< prev index next >