Mercurial > hg > icedtea8-forest > jdk
changeset 4931:8be37eae9598
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
author | alanb |
---|---|
date | Sat, 19 Nov 2011 19:59:33 +0000 |
parents | c98235762b30 |
children | 450c17e4808d |
files | test/java/util/Timer/Args.java |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/test/java/util/Timer/Args.java Sat Nov 19 19:55:19 2011 +0000 +++ b/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();