changeset 16793:02653d53d655

Merge
author jwilhelm
date Mon, 27 Feb 2017 18:24:19 +0100
parents 6dd2f49fbf96 9a22fca36ecc
children 6cbd14897a48
files
diffstat 1 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/test/javax/management/monitor/MultiMonitorTest.java	Fri Feb 24 19:48:32 2017 +0100
+++ b/test/javax/management/monitor/MultiMonitorTest.java	Mon Feb 27 18:24:19 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -116,6 +116,7 @@
         // A couple of granularity periods to detect bad behaviour
         Thread.sleep(2);
 
+        System.out.println("Checking for all listeners to be 0");
         if (!listenersAreAll(0, listeners)) {
             System.out.println("TEST FAILED: listeners not all 0");
             System.exit(1);
@@ -124,20 +125,18 @@
         for (int i = 0; i < 3; i++)
             proxies[i].start();
 
-        long startTime = System.currentTimeMillis();
-        while (!listenersAreAll(N, listeners)
-               && System.currentTimeMillis() < startTime + 5000)
-            Thread.sleep(1);
+        System.out.println("Waiting for listeners to all : " + N);
+        int iterations = 0;
+        while (!listenersAreAll(N, listeners)) {
+            Thread.sleep(500);
 
-        // More time for bad behaviour
-        Thread.sleep(1000);
-
-        if (!listenersAreAll(N, listeners)) {
-            System.out.print("TEST FAILED: listener counts wrong:");
-            for (int i = 0; i < listeners.length; i++)
-                System.out.print(" " + listeners[i].getCount());
-            System.out.println();
-            System.exit(1);
+            if (++iterations == 10) {
+               for (int i = 0; i < listeners.length; i++) {
+                   System.out.print(" " + listeners[i].getCount());
+               }
+               System.out.println();
+               iterations = 0;
+            }
         }
 
         for (int i = 0; i < 3; i++) {