java.lang.Object
com.aoapps.concurrent.ConcurrentUtils
Concurrency utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E> List
<E> Gets all of the results of the futures, returning a modifiable list of the results.static <E,
C extends Collection<E>>
CGets all of the results of the futures into the provided collection.static <K,
V> Map <K, V> Gets all of the results of the futures, returning a modifiable map of the results.static <K,
V, M extends Map<K, V>>
MGets all of the results of the futures into the provided map.static void
waitForAll
(Iterable<? extends Future<?>> futures) Waits for all futures to complete, discarding any results.
-
Method Details
-
waitForAll
public static void waitForAll(Iterable<? extends Future<?>> futures) throws InterruptedException, ExecutionException Waits for all futures to complete, discarding any results.Note: This method is cloned to IntegerRadixSort.java to avoid package dependency.
-
getAll
public static <E> List<E> getAll(Iterable<? extends Future<? extends E>> futures) throws InterruptedException, ExecutionException Gets all of the results of the futures, returning a modifiable list of the results. -
getAll
public static <E,C extends Collection<E>> C getAll(Iterable<? extends Future<? extends E>> futures, C output) throws InterruptedException, ExecutionException Gets all of the results of the futures into the provided collection.- Returns:
- the collection that was given
- Throws:
InterruptedException
ExecutionException
-
getAll
public static <K,V> Map<K,V> getAll(Map<? extends K, ? extends Future<? extends V>> futures) throws InterruptedException, ExecutionExceptionGets all of the results of the futures, returning a modifiable map of the results. The map will maintain the iteration order of the source. -
getAll
public static <K,V, M getAllM extends Map<K, V>> (Map<? extends K, ? extends Future<? extends V>> futures, M output) throws InterruptedException, ExecutionExceptionGets all of the results of the futures into the provided map.- Returns:
- the map that was given
- Throws:
InterruptedException
ExecutionException
-