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

Comparing jsr166/src/test/tck/ArrayBlockingQueueTest.java (file contents):
Revision 1.85 by jsr166, Sat May 13 22:49:01 2017 UTC vs.
Revision 1.86 by jsr166, Sun May 14 00:48:20 2017 UTC

# Line 493 | Line 493 | public class ArrayBlockingQueueTest exte
493       */
494      public void testInterruptedTimedPoll() throws InterruptedException {
495          final BlockingQueue<Integer> q = populatedQueue(SIZE);
496 <        final CountDownLatch aboutToWait = new CountDownLatch(1);
496 >        final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
497          Thread t = newStartedThread(new CheckedRunnable() {
498              public void realRun() throws InterruptedException {
499                  long startTime = System.nanoTime();
500                  for (int i = 0; i < SIZE; ++i) {
501                      assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
502                  }
503 <                aboutToWait.countDown();
503 >
504 >                pleaseInterrupt.countDown();
505                  try {
506                      q.poll(LONG_DELAY_MS, MILLISECONDS);
507                      shouldThrow();
508 <                } catch (InterruptedException success) {
509 <                    assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
510 <                }
508 >                } catch (InterruptedException success) {}
509 >                assertFalse(Thread.interrupted());
510 >
511 >                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
512              }});
513  
514 <        await(aboutToWait);
514 >        await(pleaseInterrupt);
515          assertThreadBlocks(t, Thread.State.TIMED_WAITING);
516          t.interrupt();
517          awaitTermination(t);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines