722 |
|
* returning timeout status |
723 |
|
*/ |
724 |
|
public void testInterruptedTimedPoll() throws InterruptedException { |
725 |
< |
Thread t = new ThreadShouldThrow(InterruptedException.class) { |
725 |
> |
Thread t = new Thread(new CheckedRunnable() { |
726 |
|
public void realRun() throws InterruptedException { |
727 |
|
LinkedBlockingDeque q = populatedDeque(SIZE); |
728 |
|
for (int i = 0; i < SIZE; ++i) { |
729 |
< |
threadAssertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, MILLISECONDS)).intValue()); |
729 |
> |
assertEquals(i, ((Integer)q.poll(SHORT_DELAY_MS, MILLISECONDS)).intValue()); |
730 |
|
} |
731 |
< |
q.poll(SMALL_DELAY_MS, MILLISECONDS); |
732 |
< |
}}; |
731 |
> |
try { |
732 |
> |
q.poll(SMALL_DELAY_MS, MILLISECONDS); |
733 |
> |
shouldThrow(); |
734 |
> |
} catch (InterruptedException success) {} |
735 |
> |
}}); |
736 |
|
|
737 |
|
t.start(); |
738 |
|
Thread.sleep(SHORT_DELAY_MS); |
933 |
|
* returning timeout status |
934 |
|
*/ |
935 |
|
public void testInterruptedTimedPollFirst() throws InterruptedException { |
936 |
< |
Thread t = new ThreadShouldThrow(InterruptedException.class) { |
936 |
> |
Thread t = new Thread(new CheckedRunnable() { |
937 |
|
public void realRun() throws InterruptedException { |
938 |
|
LinkedBlockingDeque q = populatedDeque(SIZE); |
939 |
|
for (int i = 0; i < SIZE; ++i) { |
940 |
< |
threadAssertEquals(i, ((Integer)q.pollFirst(SHORT_DELAY_MS, MILLISECONDS)).intValue()); |
940 |
> |
assertEquals(i, ((Integer)q.pollFirst(SHORT_DELAY_MS, MILLISECONDS)).intValue()); |
941 |
|
} |
942 |
< |
q.pollFirst(SMALL_DELAY_MS, MILLISECONDS); |
943 |
< |
}}; |
942 |
> |
try { |
943 |
> |
q.pollFirst(SMALL_DELAY_MS, MILLISECONDS); |
944 |
> |
shouldThrow(); |
945 |
> |
} catch (InterruptedException success) {} |
946 |
> |
}}); |
947 |
|
|
948 |
|
t.start(); |
949 |
|
Thread.sleep(SHORT_DELAY_MS); |
1143 |
|
* returning timeout status |
1144 |
|
*/ |
1145 |
|
public void testInterruptedTimedPollLast() throws InterruptedException { |
1146 |
< |
Thread t = new ThreadShouldThrow(InterruptedException.class) { |
1146 |
> |
Thread t = new Thread(new CheckedRunnable() { |
1147 |
|
public void realRun() throws InterruptedException { |
1148 |
|
LinkedBlockingDeque q = populatedDeque(SIZE); |
1149 |
|
for (int i = 0; i < SIZE; ++i) { |
1150 |
< |
threadAssertEquals(SIZE-i-1, ((Integer)q.pollLast(SHORT_DELAY_MS, MILLISECONDS)).intValue()); |
1150 |
> |
assertEquals(SIZE-i-1, ((Integer)q.pollLast(SHORT_DELAY_MS, MILLISECONDS)).intValue()); |
1151 |
|
} |
1152 |
< |
q.pollLast(SMALL_DELAY_MS, MILLISECONDS); |
1153 |
< |
}}; |
1152 |
> |
try { |
1153 |
> |
q.pollLast(SMALL_DELAY_MS, MILLISECONDS); |
1154 |
> |
shouldThrow(); |
1155 |
> |
} catch (InterruptedException success) {} |
1156 |
> |
}}); |
1157 |
|
|
1158 |
|
t.start(); |
1159 |
|
Thread.sleep(SHORT_DELAY_MS); |