267 |
|
public void testInvokeAny3() throws Exception { |
268 |
|
final ExecutorService e = new DirectExecutorService(); |
269 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
270 |
< |
List<Callable<Long>> l = new ArrayList<Callable<Long>>(); |
270 |
> |
List<Callable<Long>> l = new ArrayList<>(); |
271 |
|
l.add(new Callable<Long>() { |
272 |
|
public Long call() { throw new ArithmeticException(); }}); |
273 |
|
l.add(null); |
284 |
|
public void testInvokeAny4() throws InterruptedException { |
285 |
|
final ExecutorService e = new DirectExecutorService(); |
286 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
287 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
287 |
> |
List<Callable<String>> l = new ArrayList<>(); |
288 |
|
l.add(new NPETask()); |
289 |
|
try { |
290 |
|
e.invokeAny(l); |
301 |
|
public void testInvokeAny5() throws Exception { |
302 |
|
final ExecutorService e = new DirectExecutorService(); |
303 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
304 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
304 |
> |
List<Callable<String>> l = new ArrayList<>(); |
305 |
|
l.add(new StringTask()); |
306 |
|
l.add(new StringTask()); |
307 |
|
String result = e.invokeAny(l); |
339 |
|
public void testInvokeAll3() throws InterruptedException { |
340 |
|
final ExecutorService e = new DirectExecutorService(); |
341 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
342 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
342 |
> |
List<Callable<String>> l = new ArrayList<>(); |
343 |
|
l.add(new StringTask()); |
344 |
|
l.add(null); |
345 |
|
try { |
355 |
|
public void testInvokeAll4() throws Exception { |
356 |
|
final ExecutorService e = new DirectExecutorService(); |
357 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
358 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
358 |
> |
List<Callable<String>> l = new ArrayList<>(); |
359 |
|
l.add(new NPETask()); |
360 |
|
List<Future<String>> futures = e.invokeAll(l); |
361 |
|
assertEquals(1, futures.size()); |
374 |
|
public void testInvokeAll5() throws Exception { |
375 |
|
final ExecutorService e = new DirectExecutorService(); |
376 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
377 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
377 |
> |
List<Callable<String>> l = new ArrayList<>(); |
378 |
|
l.add(new StringTask()); |
379 |
|
l.add(new StringTask()); |
380 |
|
List<Future<String>> futures = e.invokeAll(l); |
403 |
|
public void testTimedInvokeAnyNullTimeUnit() throws Exception { |
404 |
|
final ExecutorService e = new DirectExecutorService(); |
405 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
406 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
406 |
> |
List<Callable<String>> l = new ArrayList<>(); |
407 |
|
l.add(new StringTask()); |
408 |
|
try { |
409 |
|
e.invokeAny(l, MEDIUM_DELAY_MS, null); |
432 |
|
public void testTimedInvokeAny3() throws Exception { |
433 |
|
final ExecutorService e = new DirectExecutorService(); |
434 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
435 |
< |
List<Callable<Long>> l = new ArrayList<Callable<Long>>(); |
435 |
> |
List<Callable<Long>> l = new ArrayList<>(); |
436 |
|
l.add(new Callable<Long>() { |
437 |
|
public Long call() { throw new ArithmeticException(); }}); |
438 |
|
l.add(null); |
450 |
|
final ExecutorService e = new DirectExecutorService(); |
451 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
452 |
|
long startTime = System.nanoTime(); |
453 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
453 |
> |
List<Callable<String>> l = new ArrayList<>(); |
454 |
|
l.add(new NPETask()); |
455 |
|
try { |
456 |
|
e.invokeAny(l, LONG_DELAY_MS, MILLISECONDS); |
469 |
|
final ExecutorService e = new DirectExecutorService(); |
470 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
471 |
|
long startTime = System.nanoTime(); |
472 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
472 |
> |
List<Callable<String>> l = new ArrayList<>(); |
473 |
|
l.add(new StringTask()); |
474 |
|
l.add(new StringTask()); |
475 |
|
String result = e.invokeAny(l, LONG_DELAY_MS, MILLISECONDS); |
497 |
|
public void testTimedInvokeAllNullTimeUnit() throws InterruptedException { |
498 |
|
final ExecutorService e = new DirectExecutorService(); |
499 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
500 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
500 |
> |
List<Callable<String>> l = new ArrayList<>(); |
501 |
|
l.add(new StringTask()); |
502 |
|
try { |
503 |
|
e.invokeAll(l, MEDIUM_DELAY_MS, null); |
523 |
|
public void testTimedInvokeAll3() throws InterruptedException { |
524 |
|
final ExecutorService e = new DirectExecutorService(); |
525 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
526 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
526 |
> |
List<Callable<String>> l = new ArrayList<>(); |
527 |
|
l.add(new StringTask()); |
528 |
|
l.add(null); |
529 |
|
try { |
539 |
|
public void testTimedInvokeAll4() throws Exception { |
540 |
|
final ExecutorService e = new DirectExecutorService(); |
541 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
542 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
542 |
> |
List<Callable<String>> l = new ArrayList<>(); |
543 |
|
l.add(new NPETask()); |
544 |
|
List<Future<String>> futures = |
545 |
|
e.invokeAll(l, LONG_DELAY_MS, MILLISECONDS); |
559 |
|
public void testTimedInvokeAll5() throws Exception { |
560 |
|
final ExecutorService e = new DirectExecutorService(); |
561 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
562 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
562 |
> |
List<Callable<String>> l = new ArrayList<>(); |
563 |
|
l.add(new StringTask()); |
564 |
|
l.add(new StringTask()); |
565 |
|
List<Future<String>> futures = |