提交 9ace6f0c 编写于 作者: A alanb

6731620: TEST_BUG: java/util/Timer/Args.java is too optimistic about the...

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
上级 ec4f0640
......@@ -92,19 +92,22 @@ public class Args {
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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册