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

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

# Line 624 | Line 624 | public class PriorityBlockingQueueTest e
624      public void testPollInExecutor() {
625          final PriorityBlockingQueue q = new PriorityBlockingQueue(2);
626          final CheckedBarrier threadsStarted = new CheckedBarrier(2);
627 <        ExecutorService executor = Executors.newFixedThreadPool(2);
628 <        executor.execute(new CheckedRunnable() {
629 <            public void realRun() throws InterruptedException {
630 <                assertNull(q.poll());
631 <                threadsStarted.await();
632 <                assertSame(one, q.poll(LONG_DELAY_MS, MILLISECONDS));
633 <                checkEmpty(q);
634 <            }});
627 >        final ExecutorService executor = Executors.newFixedThreadPool(2);
628 >        try (PoolCleaner cleaner = cleaner(executor)) {
629 >            executor.execute(new CheckedRunnable() {
630 >                public void realRun() throws InterruptedException {
631 >                    assertNull(q.poll());
632 >                    threadsStarted.await();
633 >                    assertSame(one, q.poll(LONG_DELAY_MS, MILLISECONDS));
634 >                    checkEmpty(q);
635 >                }});
636  
637 <        executor.execute(new CheckedRunnable() {
638 <            public void realRun() throws InterruptedException {
639 <                threadsStarted.await();
640 <                q.put(one);
641 <            }});
642 <
642 <        joinPool(executor);
637 >            executor.execute(new CheckedRunnable() {
638 >                public void realRun() throws InterruptedException {
639 >                    threadsStarted.await();
640 >                    q.put(one);
641 >                }});
642 >        }
643      }
644  
645      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines