493 |
|
*/ |
494 |
|
public void testTimedPollWithOffer() throws InterruptedException { |
495 |
|
final DelayQueue q = new DelayQueue(); |
496 |
+ |
final PDelay pdelay = new PDelay(0); |
497 |
|
Thread t = new Thread(new CheckedRunnable() { |
498 |
|
public void realRun() throws InterruptedException { |
499 |
|
assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); |
500 |
< |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
500 |
> |
assertSame(pdelay, q.poll(LONG_DELAY_MS, MILLISECONDS)); |
501 |
|
try { |
502 |
|
q.poll(LONG_DELAY_MS, MILLISECONDS); |
503 |
|
shouldThrow(); |
506 |
|
|
507 |
|
t.start(); |
508 |
|
Thread.sleep(SMALL_DELAY_MS); |
509 |
< |
assertTrue(q.offer(new PDelay(0), SHORT_DELAY_MS, MILLISECONDS)); |
509 |
> |
assertTrue(q.offer(pdelay, SHORT_DELAY_MS, MILLISECONDS)); |
510 |
|
t.interrupt(); |
511 |
|
t.join(); |
512 |
|
} |