ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ScheduledExecutorTest.java
(Generate patch)

Comparing jsr166/src/test/tck/ScheduledExecutorTest.java (file contents):
Revision 1.84 by jsr166, Mon Mar 20 00:34:27 2017 UTC vs.
Revision 1.86 by jsr166, Sat Mar 25 21:41:10 2017 UTC

# Line 50 | Line 50 | public class ScheduledExecutorTest exten
50              final Runnable task = new CheckedRunnable() {
51                  public void realRun() { done.countDown(); }};
52              p.execute(task);
53 <            assertTrue(done.await(LONG_DELAY_MS, MILLISECONDS));
53 >            await(done);
54          }
55      }
56  
# Line 362 | Line 362 | public class ScheduledExecutorTest exten
362                  public void realRun() throws InterruptedException {
363                      threadStarted.countDown();
364                      assertEquals(0, p.getCompletedTaskCount());
365 <                    threadProceed.await();
365 >                    await(threadProceed);
366                      threadDone.countDown();
367                  }});
368              await(threadStarted);
369              assertEquals(0, p.getCompletedTaskCount());
370              threadProceed.countDown();
371 <            threadDone.await();
371 >            await(threadDone);
372              long startTime = System.nanoTime();
373              while (p.getCompletedTaskCount() != 1) {
374                  if (millisElapsedSince(startTime) > LONG_DELAY_MS)
# Line 507 | Line 507 | public class ScheduledExecutorTest exten
507      }
508  
509      /**
510 +     * The default rejected execution handler is AbortPolicy.
511 +     */
512 +    public void testDefaultRejectedExecutionHandler() {
513 +        final ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1);
514 +        try (PoolCleaner cleaner = cleaner(p)) {
515 +            assertTrue(p.getRejectedExecutionHandler()
516 +                       instanceof ThreadPoolExecutor.AbortPolicy);
517 +        }
518 +    }
519 +
520 +    /**
521       * isShutdown is false before shutdown, true after
522       */
523      public void testIsShutdown() {
# Line 762 | Line 773 | public class ScheduledExecutorTest exten
773          Runnable task = new CheckedRunnable() { public void realRun()
774                                                      throws InterruptedException {
775              poolBlocked.countDown();
776 <            assertTrue(unblock.await(LONG_DELAY_MS, MILLISECONDS));
776 >            await(unblock);
777              ran.getAndIncrement();
778          }};
779          List<Future<?>> blockers = new ArrayList<>();
# Line 770 | Line 781 | public class ScheduledExecutorTest exten
781          List<Future<?>> delayeds = new ArrayList<>();
782          for (int i = 0; i < poolSize; i++)
783              blockers.add(p.submit(task));
784 <        assertTrue(poolBlocked.await(LONG_DELAY_MS, MILLISECONDS));
784 >        await(poolBlocked);
785  
786          periodics.add(p.scheduleAtFixedRate(countDowner(periodicLatch1),
787                                              1, 1, MILLISECONDS));
# Line 806 | Line 817 | public class ScheduledExecutorTest exten
817              }
818          }
819          if (effectivePeriodicPolicy) {
820 <            assertTrue(periodicLatch1.await(LONG_DELAY_MS, MILLISECONDS));
821 <            assertTrue(periodicLatch2.await(LONG_DELAY_MS, MILLISECONDS));
820 >            await(periodicLatch1);
821 >            await(periodicLatch2);
822              for (Future<?> periodic : periodics) {
823                  assertTrue(periodic.cancel(false));
824                  assertTrue(periodic.isCancelled());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines