6731620: TEST_BUG: java/util/Timer/Args.java is too optimistic about the execution time of System.out.printf
authoralanb
Sat, 19 Nov 2011 19:59:33 +0000
changeset 11028 937190393a12
parent 11027 0e9667605c60
child 11029 377f04adbe18
6731620: TEST_BUG: java/util/Timer/Args.java is too optimistic about the execution time of System.out.printf Reviewed-by: dholmes, forax Contributed-by: gary.adams@oracle.com
jdk/test/java/util/Timer/Args.java
--- a/jdk/test/java/util/Timer/Args.java	Sat Nov 19 19:55:19 2011 +0000
+++ b/jdk/test/java/util/Timer/Args.java	Sat Nov 19 19:59:33 2011 +0000
@@ -92,19 +92,22 @@
                new F(){void f(){ t.scheduleAtFixedRate(x, (Date)null, 42); }}
                );
 
-        final long start = System.currentTimeMillis();
-        final Date past = new Date(start - 10500);
         final CountDownLatch y1 = new CountDownLatch(1);
         final CountDownLatch y2 = new CountDownLatch(1);
         final CountDownLatch y3 = new CountDownLatch(11);
+        final long start = System.currentTimeMillis();
+        final Date past = new Date(start - 10500);
+
         schedule(           t, counter(y1), past);
         schedule(           t, counter(y2), past, 1000);
         scheduleAtFixedRate(t, counter(y3), past, 1000);
         y3.await();
         y1.await();
         y2.await();
-        System.out.printf("elapsed=%d%n", System.currentTimeMillis() - start);
-        check(System.currentTimeMillis() - start < 500);
+
+        final long elapsed = System.currentTimeMillis() - start;
+        System.out.printf("elapsed=%d%n", elapsed);
+        check(elapsed < 500);
 
         t.cancel();