--- jsr166/src/test/tck/LinkedBlockingDequeTest.java 2017/05/13 22:49:01 1.74 +++ jsr166/src/test/tck/LinkedBlockingDequeTest.java 2017/05/14 00:48:20 1.76 @@ -756,23 +756,25 @@ public class LinkedBlockingDequeTest ext */ public void testInterruptedTimedPoll() throws InterruptedException { final BlockingQueue q = populatedDeque(SIZE); - final CountDownLatch aboutToWait = new CountDownLatch(1); + final CountDownLatch pleaseInterrupt = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { long startTime = System.nanoTime(); for (int i = 0; i < SIZE; ++i) { assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS)); } - aboutToWait.countDown(); + + pleaseInterrupt.countDown(); try { q.poll(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); - } catch (InterruptedException success) { - assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); - } + } catch (InterruptedException success) {} + assertFalse(Thread.interrupted()); + + assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); }}); - await(aboutToWait); + await(pleaseInterrupt); assertThreadBlocks(t, Thread.State.TIMED_WAITING); t.interrupt(); awaitTermination(t); @@ -1076,6 +1078,7 @@ public class LinkedBlockingDequeTest ext shouldThrow(); } catch (InterruptedException success) {} assertFalse(Thread.interrupted()); + assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); }}); @@ -1121,7 +1124,7 @@ public class LinkedBlockingDequeTest ext assertTrue(q.offerFirst(zero, LONG_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); barrier.await(); - assertThreadStaysAlive(t); + assertThreadBlocks(t, Thread.State.TIMED_WAITING); t.interrupt(); awaitTermination(t); }