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.63 by jsr166, Sat May 23 00:53:08 2015 UTC vs.
Revision 1.65 by jsr166, Sun Oct 4 18:49:02 2015 UTC

# Line 62 | Line 62 | public class PriorityBlockingQueueTest e
62          PriorityBlockingQueue<Integer> q =
63              new PriorityBlockingQueue<Integer>(n);
64          assertTrue(q.isEmpty());
65 <        for (int i = n-1; i >= 0; i -= 2)
65 >        for (int i = n - 1; i >= 0; i -= 2)
66              assertTrue(q.offer(new Integer(i)));
67          for (int i = (n & 1); i < n; i += 2)
68              assertTrue(q.offer(new Integer(i)));
# 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 <            }});
635 <
636 <        executor.execute(new CheckedRunnable() {
637 <            public void realRun() throws InterruptedException {
638 <                threadsStarted.await();
639 <                q.put(one);
640 <            }});
641 <
642 <        joinPool(executor);
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 >        }
643      }
644  
645      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines