Java Thread Future waitForAll(List> res)

Here you can find the source of waitForAll(List> res)

Description

For lists of Future results that we are uninterested in, act as a Barrier and attempt to get all futures.

License

Open Source License

Parameter

Parameter Description
res must not be null.

Declaration

public static void waitForAll(List<Future<Void>> res) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

public class Main {
    /**/*from   www. j  a v  a 2 s  . c o m*/
     * For lists of Future results that we are uninterested in, act as a Barrier
     * and attempt to get all futures. Exceptions will be silently ignored.
     * 
     * @param res must not be null.
     */
    public static void waitForAll(List<Future<Void>> res) {
        for (Future<?> f : res)
            try {
                f.get();
            } catch (InterruptedException | ExecutionException e) {
                // Don't worry about it.
            }
    }
}

Related

  1. transferResult(final CompletionStage source, final CompletableFuture target)
  2. transferResult(final CompletionStage source, final CompletableFuture target)
  3. unwrap(Throwable throwable, Class throwableA)
  4. waitFor(Future future)
  5. waitForAll(List> futures)
  6. waitForCompletion(Collection> futures)
  7. waitForCompletion(Future[] futures)
  8. waitForTasks(List futures)