--- jsr166/src/test/tck/LinkedBlockingQueueTest.java 2017/05/14 00:56:43 1.72 +++ jsr166/src/test/tck/LinkedBlockingQueueTest.java 2017/05/14 04:14:09 1.75 @@ -314,6 +314,13 @@ public class LinkedBlockingQueueTest ext pleaseTake.countDown(); q.put(86); + Thread.currentThread().interrupt(); + try { + q.put(99); + shouldThrow(); + } catch (InterruptedException success) {} + assertFalse(Thread.interrupted()); + pleaseInterrupt.countDown(); try { q.put(99); @@ -343,9 +350,18 @@ public class LinkedBlockingQueueTest ext public void realRun() throws InterruptedException { q.put(new Object()); q.put(new Object()); + long startTime = System.nanoTime(); assertFalse(q.offer(new Object(), timeoutMillis(), MILLISECONDS)); assertTrue(millisElapsedSince(startTime) >= timeoutMillis()); + + Thread.currentThread().interrupt(); + try { + q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS); + shouldThrow(); + } catch (InterruptedException success) {} + assertFalse(Thread.interrupted()); + pleaseInterrupt.countDown(); try { q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS); @@ -449,9 +465,15 @@ public class LinkedBlockingQueueTest ext Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { long startTime = System.nanoTime(); - for (int i = 0; i < SIZE; ++i) { + for (int i = 0; i < SIZE; i++) assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS)); - } + + Thread.currentThread().interrupt(); + try { + q.poll(LONG_DELAY_MS, MILLISECONDS); + shouldThrow(); + } catch (InterruptedException success) {} + assertFalse(Thread.interrupted()); pleaseInterrupt.countDown(); try {