test/java/util/logging/LoggingDeadlock4.java
Print this page
rev 5551 : 8004928: TEST_BUG: Reduce dependence of CoreLib tests from the AWT subsystem
Summary: the tests were refactored to drop AWT dependence where it was possible.
Reviewed-by: alanb, mchung
@@ -21,15 +21,15 @@
* questions.
*/
/*
* @test
- * @bug 6977677
+ * @bug 6977677 8004928
* @summary Deadlock between LogManager.<clinit> and Logger.getLogger()
* @author Daniel D. Daugherty
- * @build LoggingDeadlock4
- * @run main/timeout=15 LoggingDeadlock4
+ * @compile -XDignore.symbol.file LoggingDeadlock4.java
+ * @run main/othervm/timeout=15 LoggingDeadlock4
*/
import java.awt.Container;
import java.util.concurrent.CountDownLatch;
import java.util.logging.LogManager;
@@ -38,25 +38,20 @@
public class LoggingDeadlock4 {
private static CountDownLatch barrier = new CountDownLatch(1);
private static CountDownLatch lmIsRunning = new CountDownLatch(1);
private static CountDownLatch logIsRunning = new CountDownLatch(1);
- public static void main(String[] args) {
- System.out.println("main: LoggingDeadlock4 is starting.");
-
- // Loading the java.awt.Container class will create a
- // sun.util.logging.PlatformLogger$JavaLogger object
+ // Create a sun.util.logging.PlatformLogger$JavaLogger object
// that has to be redirected when the LogManager class
// is initialized. This can cause a deadlock between
// LogManager.<clinit> and Logger.getLogger().
- try {
- Class.forName("java.awt.Container");
- } catch (ClassNotFoundException cnfe) {
- throw new RuntimeException("Test failed: could not load"
- + " java.awt.Container." + cnfe);
- }
+ private static final sun.util.logging.PlatformLogger log =
+ sun.util.logging.PlatformLogger.getLogger("java.util.logging");
+ public static void main(String[] args) {
+ System.out.println("main: LoggingDeadlock4 is starting.");
+
Thread lmThread = new Thread("LogManagerThread") {
public void run() {
// let main know LogManagerThread is running
lmIsRunning.countDown();