1353 |
|
* timed invokeAny(c) throws NPE if c has null elements |
1354 |
|
*/ |
1355 |
|
public void testTimedInvokeAny3() throws Exception { |
1356 |
+ |
final CountDownLatch latch = new CountDownLatch(1); |
1357 |
|
ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
1358 |
|
try { |
1359 |
|
ArrayList<Callable<String>> l = new ArrayList<Callable<String>>(); |
1360 |
< |
l.add(new StringTask()); |
1360 |
> |
l.add(new Callable<String>() { |
1361 |
> |
public String call() { |
1362 |
> |
try { |
1363 |
> |
latch.await(); |
1364 |
> |
} catch (InterruptedException ok) {} |
1365 |
> |
return TEST_STRING; |
1366 |
> |
}}); |
1367 |
|
l.add(null); |
1368 |
|
e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS); |
1369 |
|
shouldThrow(); |
1370 |
|
} catch (NullPointerException success) { |
1371 |
|
} finally { |
1372 |
+ |
latch.countDown(); |
1373 |
|
joinPool(e); |
1374 |
|
} |
1375 |
|
} |