746 |
|
*/ |
747 |
|
public void testTimedPollWithOffer() throws InterruptedException { |
748 |
|
final LinkedBlockingDeque q = new LinkedBlockingDeque(2); |
749 |
< |
Thread t = new ThreadShouldThrow(InterruptedException.class) { |
749 |
> |
Thread t = new Thread(new CheckedRunnable() { |
750 |
|
public void realRun() throws InterruptedException { |
751 |
< |
threadAssertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); |
752 |
< |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
753 |
< |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
754 |
< |
}}; |
751 |
> |
assertNull(q.poll(SHORT_DELAY_MS, MILLISECONDS)); |
752 |
> |
assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS)); |
753 |
> |
try { |
754 |
> |
q.poll(LONG_DELAY_MS, MILLISECONDS); |
755 |
> |
shouldThrow(); |
756 |
> |
} catch (InterruptedException success) {} |
757 |
> |
}}); |
758 |
|
|
759 |
|
t.start(); |
760 |
|
Thread.sleep(SMALL_DELAY_MS); |
960 |
|
*/ |
961 |
|
public void testTimedPollFirstWithOfferFirst() throws InterruptedException { |
962 |
|
final LinkedBlockingDeque q = new LinkedBlockingDeque(2); |
963 |
< |
Thread t = new ThreadShouldThrow(InterruptedException.class) { |
963 |
> |
Thread t = new Thread(new CheckedRunnable() { |
964 |
|
public void realRun() throws InterruptedException { |
965 |
< |
threadAssertNull(q.pollFirst(SHORT_DELAY_MS, MILLISECONDS)); |
966 |
< |
q.pollFirst(LONG_DELAY_MS, MILLISECONDS); |
967 |
< |
q.pollFirst(LONG_DELAY_MS, MILLISECONDS); |
968 |
< |
}}; |
965 |
> |
assertNull(q.pollFirst(SHORT_DELAY_MS, MILLISECONDS)); |
966 |
> |
assertSame(zero, q.pollFirst(LONG_DELAY_MS, MILLISECONDS)); |
967 |
> |
try { |
968 |
> |
q.pollFirst(LONG_DELAY_MS, MILLISECONDS); |
969 |
> |
shouldThrow(); |
970 |
> |
} catch (InterruptedException success) {} |
971 |
> |
}}); |
972 |
|
|
973 |
|
t.start(); |
974 |
|
Thread.sleep(SMALL_DELAY_MS); |