Doug Lea writes:
When unexpired elements remain, DelayQueue.poll(timeout, unit)
may busy-wait past the given timeout until one expires.
A test case is in src/test/tck/DelayQueueTest. This
hangs (for about 293 years) rather than returning in a few
milliseconds. (A stand-alone test isn't worth writing).
public void testTimedPollDelayed() {
DelayQueue q = new DelayQueue();
q.add(new NanoDelay(Long.MAX_VALUE));
try {
assertNull(q.poll(SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
} catch (Exception ex) {
unexpectedException();
}
}