changeset 20761:b14f02adbe01

8025205: Intermittent test failure: javax/management/remote/mandatory/connection/BrokenConnectionTest.java Reviewed-by: dholmes, dfuchs, jbachorik
author sjiang
date Thu, 10 Oct 2013 09:01:19 +0200
parents 50de706b1565
children 7ec392af43cd
files jdk/test/javax/management/remote/mandatory/connection/BrokenConnectionTest.java
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/javax/management/remote/mandatory/connection/BrokenConnectionTest.java	Thu Oct 10 08:49:12 2013 +0200
+++ b/jdk/test/javax/management/remote/mandatory/connection/BrokenConnectionTest.java	Thu Oct 10 09:01:19 2013 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4940957
+ * @bug 4940957 8025205
  * @summary Tests behaviour when connections break
  * @author Eamonn McManus
  * @run clean BrokenConnectionTest
@@ -485,14 +485,13 @@
             }
             if (thisok) {
                 System.out.println("Waiting for failure notif");
-                long deadline = System.currentTimeMillis() + 5000;
-                while (failureListener.count < 1
-                       && System.currentTimeMillis() < deadline)
-                    Thread.sleep(500);
-                if (failureListener.count < 1) {
-                    System.out.println("Did not get failure notif!");
-                    thisok = false;
-                } else if (failureListener.count > 1) {
+                // pass or test timeout. see 8025205
+                do {
+                    Thread.sleep(100);
+                } while (failureListener.count < 1);
+
+                Thread.sleep(1000); // if more notif coming ...
+                if (failureListener.count > 1) {
                     System.out.println("Got too many failure notifs: " +
                                        failureListener.count);
                     thisok = false;