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.83 by jsr166, Sat May 13 21:52:59 2017 UTC vs.
Revision 1.86 by jsr166, Sun May 14 00:48:20 2017 UTC

# Line 340 | Line 340 | public class ArrayBlockingQueueTest exte
340              }});
341  
342          await(pleaseInterrupt);
343 <        assertThreadStaysAlive(t);
343 >        assertThreadBlocks(t, Thread.State.WAITING);
344          t.interrupt();
345          awaitTermination(t);
346          assertEquals(SIZE, q.size());
# Line 402 | Line 402 | public class ArrayBlockingQueueTest exte
402              }});
403  
404          await(pleaseInterrupt);
405 <        assertThreadStaysAlive(t);
405 >        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
406          t.interrupt();
407          awaitTermination(t);
408      }
# 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);
515 <        waitForThreadToEnterWaitState(t);
514 >        await(pleaseInterrupt);
515 >        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
516          t.interrupt();
517          awaitTermination(t);
518          checkEmpty(q);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines