--- jsr166/src/test/tck/LinkedBlockingQueueTest.java 2017/05/14 04:02:06 1.74 +++ jsr166/src/test/tck/LinkedBlockingQueueTest.java 2018/01/07 22:59:18 1.77 @@ -59,8 +59,7 @@ public class LinkedBlockingQueueTest ext * Integers 0 ... n - 1. */ private static LinkedBlockingQueue populatedQueue(int n) { - LinkedBlockingQueue q = - new LinkedBlockingQueue(n); + LinkedBlockingQueue q = new LinkedBlockingQueue<>(n); assertTrue(q.isEmpty()); for (int i = 0; i < n; i++) assertTrue(q.offer(new Integer(i))); @@ -350,9 +349,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); @@ -787,7 +795,7 @@ public class LinkedBlockingQueueTest ext } /** - * A deserialized serialized queue has same elements in same order + * A deserialized/reserialized queue has same elements in same order */ public void testSerialization() throws Exception { Queue x = populatedQueue(SIZE);