451 |
|
final CountDownLatch aboutToWait = new CountDownLatch(1); |
452 |
|
Thread t = newStartedThread(new CheckedRunnable() { |
453 |
|
public void realRun() throws InterruptedException { |
454 |
+ |
long startTime = System.nanoTime(); |
455 |
|
for (int i = 0; i < SIZE; ++i) { |
456 |
< |
long startTime = System.nanoTime(); |
456 |
< |
assertEquals(i, (int) q.poll(2*LONG_DELAY_MS, MILLISECONDS)); |
457 |
< |
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
456 |
> |
assertEquals(i, (int) q.poll(LONG_DELAY_MS, MILLISECONDS)); |
457 |
|
} |
459 |
– |
long startTime = System.nanoTime(); |
458 |
|
aboutToWait.countDown(); |
459 |
|
try { |
460 |
< |
q.poll(2*LONG_DELAY_MS, MILLISECONDS); |
460 |
> |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
461 |
|
shouldThrow(); |
462 |
|
} catch (InterruptedException success) { |
463 |
|
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
467 |
|
await(aboutToWait); |
468 |
|
waitForThreadToEnterWaitState(t, LONG_DELAY_MS); |
469 |
|
t.interrupt(); |
470 |
< |
awaitTermination(t, LONG_DELAY_MS); |
470 |
> |
awaitTermination(t); |
471 |
|
checkEmpty(q); |
472 |
|
} |
473 |
|
|