changeset 1085:98cd842c1c5a

6736461: ThreadMXBean Locks.java fails intermittently. Summary: Fixed the test to wait for the right state before calling check thread information. Reviewed-by: jjh
author swamyv
date Tue, 19 Aug 2008 12:46:34 -0700
parents 4d4d63dfdef9
children 0e9b52b4732d
files jdk/test/java/lang/management/ThreadMXBean/Locks.java
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/java/lang/management/ThreadMXBean/Locks.java	Mon Aug 18 15:28:54 2008 -0700
+++ b/jdk/test/java/lang/management/ThreadMXBean/Locks.java	Tue Aug 19 12:46:34 2008 -0700
@@ -197,8 +197,12 @@
             synchronized (ready) {
                 // wait until WaitingThread about to wait for objC
                 thrsync.waitForSignal();
-                // give chance to enter wait.
-                goSleep(100);
+
+                int retryCount = 0;
+                while (waiter.getState() != Thread.State.WAITING
+                       && retryCount++ < 500) {
+                   goSleep(100);
+                }
                 checkBlockedObject(waiter, objC, null, Thread.State.WAITING);
 
                 synchronized (objC) {