314 |
|
final BlockingQueue<Integer> q = populatedQueue(SIZE); |
315 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
316 |
|
public void realRun() throws InterruptedException { |
317 |
– |
long startTime = System.nanoTime(); |
317 |
|
Thread.currentThread().interrupt(); |
318 |
|
for (int i = 0; i < SIZE; ++i) |
319 |
|
assertEquals(i, (int) q.poll(randomTimeout(), randomTimeUnit())); |
322 |
|
shouldThrow(); |
323 |
|
} catch (InterruptedException success) {} |
324 |
|
assertFalse(Thread.interrupted()); |
326 |
– |
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
325 |
|
}}); |
326 |
|
|
327 |
|
awaitTermination(t); |
950 |
|
|
951 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
952 |
|
public void realRun() throws InterruptedException { |
955 |
– |
long startTime = System.nanoTime(); |
953 |
|
Thread.currentThread().interrupt(); |
954 |
|
try { |
955 |
|
q.tryTransfer(new Object(), randomTimeout(), randomTimeUnit()); |
959 |
|
|
960 |
|
pleaseInterrupt.countDown(); |
961 |
|
try { |
962 |
< |
q.tryTransfer(new Object(), LONG_DELAY_MS, MILLISECONDS); |
962 |
> |
q.tryTransfer(new Object(), LONGER_DELAY_MS, MILLISECONDS); |
963 |
|
shouldThrow(); |
964 |
|
} catch (InterruptedException success) {} |
965 |
|
assertFalse(Thread.interrupted()); |
969 |
– |
|
970 |
– |
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
966 |
|
}}); |
967 |
|
|
968 |
|
await(pleaseInterrupt); |