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

Comparing jsr166/src/test/tck/DelayQueueTest.java (file contents):
Revision 1.74 by jsr166, Sun May 24 01:42:14 2015 UTC vs.
Revision 1.75 by jsr166, Sun Oct 4 18:49:02 2015 UTC

# Line 653 | Line 653 | public class DelayQueueTest extends JSR1
653      public void testPollInExecutor() {
654          final DelayQueue q = new DelayQueue();
655          final CheckedBarrier threadsStarted = new CheckedBarrier(2);
656 <        ExecutorService executor = Executors.newFixedThreadPool(2);
657 <        executor.execute(new CheckedRunnable() {
658 <            public void realRun() throws InterruptedException {
659 <                assertNull(q.poll());
660 <                threadsStarted.await();
661 <                assertNotNull(q.poll(LONG_DELAY_MS, MILLISECONDS));
662 <                checkEmpty(q);
663 <            }});
656 >        final ExecutorService executor = Executors.newFixedThreadPool(2);
657 >        try (PoolCleaner cleaner = cleaner(executor)) {
658 >            executor.execute(new CheckedRunnable() {
659 >                public void realRun() throws InterruptedException {
660 >                    assertNull(q.poll());
661 >                    threadsStarted.await();
662 >                    assertNotNull(q.poll(LONG_DELAY_MS, MILLISECONDS));
663 >                    checkEmpty(q);
664 >                }});
665  
666 <        executor.execute(new CheckedRunnable() {
667 <            public void realRun() throws InterruptedException {
668 <                threadsStarted.await();
669 <                q.put(new PDelay(1));
670 <            }});
671 <
671 <        joinPool(executor);
666 >            executor.execute(new CheckedRunnable() {
667 >                public void realRun() throws InterruptedException {
668 >                    threadsStarted.await();
669 >                    q.put(new PDelay(1));
670 >                }});
671 >        }
672      }
673  
674      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines