--- jsr166/src/test/tck/ScheduledExecutorTest.java 2015/10/12 16:49:28 1.77 +++ jsr166/src/test/tck/ScheduledExecutorTest.java 2016/02/22 20:40:12 1.79 @@ -154,17 +154,17 @@ public class ScheduledExecutorTest exten final CountDownLatch done = new CountDownLatch(cycles); Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); }}; - ScheduledFuture h = + ScheduledFuture periodicTask = p.scheduleAtFixedRate(task, 0, delay, MILLISECONDS); await(done); - h.cancel(true); - double normalizedTime = + periodicTask.cancel(true); + double elapsedDelays = (double) millisElapsedSince(startTime) / delay; - if (normalizedTime >= cycles - 1 && - normalizedTime <= cycles) + if (elapsedDelays >= cycles - 1 && + elapsedDelays <= cycles) return; } - throw new AssertionError("unexpected execution rate"); + fail("unexpected execution rate"); } } @@ -180,17 +180,17 @@ public class ScheduledExecutorTest exten final CountDownLatch done = new CountDownLatch(cycles); Runnable task = new CheckedRunnable() { public void realRun() { done.countDown(); }}; - ScheduledFuture h = + ScheduledFuture periodicTask = p.scheduleWithFixedDelay(task, 0, delay, MILLISECONDS); await(done); - h.cancel(true); - double normalizedTime = + periodicTask.cancel(true); + double elapsedDelays = (double) millisElapsedSince(startTime) / delay; - if (normalizedTime >= cycles - 1 && - normalizedTime <= cycles) + if (elapsedDelays >= cycles - 1 && + elapsedDelays <= cycles) return; } - throw new AssertionError("unexpected execution rate"); + fail("unexpected execution rate"); } }