472 |
|
*/ |
473 |
|
public void testTimedPollWithOffer() throws InterruptedException { |
474 |
|
final ArrayBlockingQueue q = new ArrayBlockingQueue(2); |
475 |
< |
Thread t = new ThreadShouldThrow(InterruptedException.class) { |
475 |
> |
Thread t = new Thread(new CheckedRunnable() { |
476 |
|
public void realRun() throws InterruptedException { |
477 |
< |
threadAssertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); |
478 |
< |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
479 |
< |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
480 |
< |
}}; |
477 |
> |
assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); |
478 |
> |
assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS)); |
479 |
> |
try { |
480 |
> |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
481 |
> |
shouldThrow(); |
482 |
> |
} catch (InterruptedException success) {} |
483 |
> |
}}); |
484 |
|
|
485 |
|
t.start(); |
486 |
|
Thread.sleep(SMALL_DELAY_MS); |