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

Comparing jsr166/src/test/tck/LinkedBlockingQueueTest.java (file contents):
Revision 1.68 by jsr166, Sat May 13 21:52:59 2017 UTC vs.
Revision 1.71 by jsr166, Sun May 14 00:48:20 2017 UTC

# Line 292 | Line 292 | public class LinkedBlockingQueueTest ext
292              }});
293  
294          await(pleaseInterrupt);
295 <        assertThreadStaysAlive(t);
295 >        assertThreadBlocks(t, Thread.State.WAITING);
296          t.interrupt();
297          awaitTermination(t);
298          assertEquals(SIZE, q.size());
# Line 354 | Line 354 | public class LinkedBlockingQueueTest ext
354              }});
355  
356          await(pleaseInterrupt);
357 <        assertThreadStaysAlive(t);
357 >        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
358          t.interrupt();
359          awaitTermination(t);
360      }
# Line 444 | Line 444 | public class LinkedBlockingQueueTest ext
444       */
445      public void testInterruptedTimedPoll() throws InterruptedException {
446          final BlockingQueue<Integer> q = populatedQueue(SIZE);
447 <        final CountDownLatch aboutToWait = new CountDownLatch(1);
447 >        final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
448          Thread t = newStartedThread(new CheckedRunnable() {
449              public void realRun() throws InterruptedException {
450                  long startTime = System.nanoTime();
451                  for (int i = 0; i < SIZE; ++i) {
452                      assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS));
453                  }
454 <                aboutToWait.countDown();
454 >
455 >                pleaseInterrupt.countDown();
456                  try {
457                      q.poll(LONG_DELAY_MS, MILLISECONDS);
458                      shouldThrow();
459 <                } catch (InterruptedException success) {
460 <                    assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
461 <                }
459 >                } catch (InterruptedException success) {}
460 >                assertFalse(Thread.interrupted());
461 >
462 >                assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS);
463              }});
464  
465 <        await(aboutToWait);
466 <        waitForThreadToEnterWaitState(t);
465 >        await(pleaseInterrupt);
466 >        assertThreadBlocks(t, Thread.State.TIMED_WAITING);
467          t.interrupt();
468          awaitTermination(t);
469          checkEmpty(q);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines