--- jsr166/src/test/tck/ScheduledExecutorTest.java 2015/10/08 03:08:37 1.76 +++ jsr166/src/test/tck/ScheduledExecutorTest.java 2015/10/25 02:58:25 1.78 @@ -164,7 +164,7 @@ public class ScheduledExecutorTest exten normalizedTime <= cycles) return; } - throw new AssertionError("unexpected execution rate"); + fail("unexpected execution rate"); } } @@ -190,7 +190,7 @@ public class ScheduledExecutorTest exten normalizedTime <= cycles) return; } - throw new AssertionError("unexpected execution rate"); + fail("unexpected execution rate"); } } @@ -1206,4 +1206,27 @@ public class ScheduledExecutorTest exten } } + /** + * A fixed delay task with overflowing period should not prevent a + * one-shot task from executing. + * https://bugs.openjdk.java.net/browse/JDK-8051859 + */ + public void testScheduleWithFixedDelay_overflow() throws Exception { + final CountDownLatch delayedDone = new CountDownLatch(1); + final CountDownLatch immediateDone = new CountDownLatch(1); + final ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1); + try (PoolCleaner cleaner = cleaner(p)) { + final Runnable immediate = new Runnable() { public void run() { + immediateDone.countDown(); + }}; + final Runnable delayed = new Runnable() { public void run() { + delayedDone.countDown(); + p.submit(immediate); + }}; + p.scheduleWithFixedDelay(delayed, 0L, Long.MAX_VALUE, SECONDS); + await(delayedDone); + await(immediateDone); + } + } + }