448 |
|
* returning timeout status |
449 |
|
*/ |
450 |
|
public void testInterruptedTimedPoll() throws InterruptedException { |
451 |
< |
Thread t = new ThreadShouldThrow(InterruptedException.class) { |
451 |
> |
Thread t = new Thread(new CheckedRunnable() { |
452 |
|
public void realRun() throws InterruptedException { |
453 |
|
ArrayBlockingQueue q = populatedQueue(SIZE); |
454 |
|
for (int i = 0; i < SIZE; ++i) { |
455 |
< |
threadAssertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, MILLISECONDS)).intValue()); |
455 |
> |
assertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, MILLISECONDS)).intValue()); |
456 |
|
} |
457 |
< |
q.poll(MEDIUM_DELAY_MS, MILLISECONDS); |
458 |
< |
}}; |
457 |
> |
try { |
458 |
> |
q.poll(SMALL_DELAY_MS, MILLISECONDS); |
459 |
> |
} catch (InterruptedException success) {} |
460 |
> |
}}); |
461 |
|
|
462 |
|
t.start(); |
463 |
< |
Thread.sleep(SMALL_DELAY_MS); |
463 |
> |
Thread.sleep(SHORT_DELAY_MS); |
464 |
|
t.interrupt(); |
465 |
|
t.join(); |
466 |
|
} |