463 |
|
*/ |
464 |
|
public void testTimedPollWithOffer() throws InterruptedException { |
465 |
|
final LinkedBlockingQueue q = new LinkedBlockingQueue(2); |
466 |
< |
Thread t = new ThreadShouldThrow(InterruptedException.class) { |
466 |
> |
Thread t = new Thread(new CheckedRunnable() { |
467 |
|
public void realRun() throws InterruptedException { |
468 |
< |
threadAssertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); |
469 |
< |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
470 |
< |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
471 |
< |
}}; |
468 |
> |
assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); |
469 |
> |
assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS)); |
470 |
> |
try { |
471 |
> |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
472 |
> |
shouldThrow(); |
473 |
> |
} catch (InterruptedException success) {} |
474 |
> |
}}); |
475 |
|
|
476 |
|
t.start(); |
477 |
|
Thread.sleep(SMALL_DELAY_MS); |