428 |
|
shouldThrow(); |
429 |
|
} catch (InterruptedException success) {} |
430 |
|
assertFalse(Thread.interrupted()); |
431 |
+ |
|
432 |
|
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
433 |
|
}}); |
434 |
|
|
435 |
|
await(pleaseInterrupt); |
436 |
< |
assertThreadStaysAlive(t); |
436 |
> |
assertThreadBlocks(t, Thread.State.TIMED_WAITING); |
437 |
|
t.interrupt(); |
438 |
|
awaitTermination(t); |
439 |
|
checkEmpty(q); |
714 |
|
public void testTimedPollDelayed() throws InterruptedException { |
715 |
|
DelayQueue q = new DelayQueue(); |
716 |
|
q.add(new NanoDelay(LONG_DELAY_MS * 1000000L)); |
717 |
+ |
long startTime = System.nanoTime(); |
718 |
|
assertNull(q.poll(timeoutMillis(), MILLISECONDS)); |
719 |
+ |
assertTrue(millisElapsedSince(startTime) >= timeoutMillis()); |
720 |
|
} |
721 |
|
|
722 |
|
/** |