1228 |
|
* timed invokeAny(c) throws NPE if c has null elements |
1229 |
|
*/ |
1230 |
|
public void testTimedInvokeAny3() throws Exception { |
1231 |
+ |
final CountDownLatch latch = new CountDownLatch(1); |
1232 |
|
ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
1233 |
|
try { |
1234 |
|
ArrayList<Callable<String>> l = new ArrayList<Callable<String>>(); |
1235 |
< |
l.add(new StringTask()); |
1235 |
> |
l.add(new Callable<String>() { |
1236 |
> |
public String call() { |
1237 |
> |
try { |
1238 |
> |
latch.await(); |
1239 |
> |
} catch (InterruptedException ok) {} |
1240 |
> |
return TEST_STRING; |
1241 |
> |
}}); |
1242 |
|
l.add(null); |
1243 |
|
e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); |
1244 |
|
shouldThrow(); |
1245 |
|
} catch (NullPointerException success) { |
1246 |
|
} finally { |
1247 |
+ |
latch.countDown(); |
1248 |
|
joinPool(e); |
1249 |
|
} |
1250 |
|
} |