776 |
|
final CountDownLatch pleaseInterrupt = new CountDownLatch(1); |
777 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
778 |
|
public void realRun() throws InterruptedException { |
779 |
– |
long startTime = System.nanoTime(); |
779 |
|
for (int i = 0; i < SIZE; i++) |
780 |
|
assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS)); |
781 |
|
|
788 |
|
|
789 |
|
pleaseInterrupt.countDown(); |
790 |
|
try { |
791 |
< |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
791 |
> |
q.poll(LONGER_DELAY_MS, MILLISECONDS); |
792 |
|
shouldThrow(); |
793 |
|
} catch (InterruptedException success) {} |
794 |
|
assertFalse(Thread.interrupted()); |
796 |
– |
|
797 |
– |
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
795 |
|
}}); |
796 |
|
|
797 |
|
await(pleaseInterrupt); |
1092 |
|
final CountDownLatch pleaseInterrupt = new CountDownLatch(1); |
1093 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
1094 |
|
public void realRun() throws InterruptedException { |
1098 |
– |
long startTime = System.nanoTime(); |
1095 |
|
for (int i = 0; i < SIZE; i++) |
1096 |
|
assertEquals(i, q.pollFirst(LONG_DELAY_MS, MILLISECONDS)); |
1097 |
|
|
1104 |
|
|
1105 |
|
pleaseInterrupt.countDown(); |
1106 |
|
try { |
1107 |
< |
q.pollFirst(LONG_DELAY_MS, MILLISECONDS); |
1107 |
> |
q.pollFirst(LONGER_DELAY_MS, MILLISECONDS); |
1108 |
|
shouldThrow(); |
1109 |
|
} catch (InterruptedException success) {} |
1110 |
|
assertFalse(Thread.interrupted()); |
1115 |
– |
|
1116 |
– |
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
1111 |
|
}}); |
1112 |
|
|
1113 |
|
await(pleaseInterrupt); |
1374 |
|
final CountDownLatch pleaseInterrupt = new CountDownLatch(1); |
1375 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
1376 |
|
public void realRun() throws InterruptedException { |
1383 |
– |
long startTime = System.nanoTime(); |
1377 |
|
for (int i = 0; i < SIZE; i++) |
1378 |
|
assertEquals(SIZE - i - 1, |
1379 |
|
q.pollLast(LONG_DELAY_MS, MILLISECONDS)); |
1387 |
|
|
1388 |
|
pleaseInterrupt.countDown(); |
1389 |
|
try { |
1390 |
< |
q.pollLast(LONG_DELAY_MS, MILLISECONDS); |
1390 |
> |
q.pollLast(LONGER_DELAY_MS, MILLISECONDS); |
1391 |
|
shouldThrow(); |
1392 |
|
} catch (InterruptedException success) {} |
1393 |
|
assertFalse(Thread.interrupted()); |
1401 |
– |
|
1402 |
– |
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
1394 |
|
}}); |
1395 |
|
|
1396 |
|
await(pleaseInterrupt); |