8137289: java/util/logging/DrainFindDeadlockTest.java hangs
authordfuchs
Wed, 30 Sep 2015 11:17:32 +0200
changeset 32841 4ae281bb919c
parent 32840 02bff5d9f260
child 32842 831e91e26c15
8137289: java/util/logging/DrainFindDeadlockTest.java hangs Summary: removed timeout=10 from @run command line. added new debug traces. Reviewed-by: chegar, mchung
jdk/test/java/util/logging/DrainFindDeadlockTest.java
--- a/jdk/test/java/util/logging/DrainFindDeadlockTest.java	Wed Sep 30 12:48:32 2015 +0530
+++ b/jdk/test/java/util/logging/DrainFindDeadlockTest.java	Wed Sep 30 11:17:32 2015 +0200
@@ -35,7 +35,7 @@
  * @summary check for deadlock between findLogger() and drainLoggerRefQueueBounded()
  * @author jim.gish@oracle.com
  * @build DrainFindDeadlockTest
- * @run main/othervm/timeout=10 DrainFindDeadlockTest
+ * @run main/othervm DrainFindDeadlockTest
  * @key randomness
  */
 
@@ -109,9 +109,13 @@
         public void run() {
             System.out.println("Running " + Thread.currentThread().getName());
 
-            for (int i=0; i < MAX_ITERATIONS; i++) {
-                logger = Logger.getLogger("DrainFindDeadlockTest"+i);
-                DrainFindDeadlockTest.randomDelay();
+            try {
+                for (int i=0; i < MAX_ITERATIONS; i++) {
+                    logger = Logger.getLogger("DrainFindDeadlockTest"+i);
+                    DrainFindDeadlockTest.randomDelay();
+                }
+            } finally {
+                System.out.println("Completed " + Thread.currentThread().getName());
             }
         }
     }
@@ -120,13 +124,17 @@
         @Override
         public void run() {
             System.out.println("Running " + Thread.currentThread().getName());
-            for (int i=0; i < MAX_ITERATIONS; i++) {
-                try {
-                    mgr.readConfiguration();
-                } catch (IOException | SecurityException ex) {
-                    throw new RuntimeException("FAILED: test setup problem", ex);
+            try {
+                for (int i=0; i < MAX_ITERATIONS; i++) {
+                    try {
+                        mgr.readConfiguration();
+                    } catch (IOException | SecurityException ex) {
+                        throw new RuntimeException("FAILED: test setup problem", ex);
+                    }
+                    DrainFindDeadlockTest.randomDelay();
                 }
-                DrainFindDeadlockTest.randomDelay();
+            } finally {
+                System.out.println("Completed " + Thread.currentThread().getName());
             }
         }
     }
@@ -185,12 +193,16 @@
         @Override
         public void run() {
             System.out.println("Running " + Thread.currentThread().getName());
-            for (int i=0; i < MAX_ITERATIONS*2; i++) {
-                checkState(t1, t2);
-                try {
-                    Thread.sleep(10);
-                } catch (InterruptedException ex) {
-                };
+            try {
+                for (int i=0; i < MAX_ITERATIONS*2; i++) {
+                    checkState(t1, t2);
+                    try {
+                        Thread.sleep(10);
+                    } catch (InterruptedException ex) {
+                    }
+                }
+            } finally {
+                System.out.println("Completed " + Thread.currentThread().getName());
             }
         }
     }