- java.lang.Object
-
- com.aoapps.concurrent.ConcurrentUtils
-
public final class ConcurrentUtils extends Object
Concurrency utilities.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E> List<E>getAll(Iterable<? extends Future<? extends E>> futures)Gets all of the results of the futures, returning a modifiable list of the results.static <E,C extends Collection<E>>
CgetAll(Iterable<? extends Future<? extends E>> futures, C output)Gets all of the results of the futures into the provided collection.static <K,V>
Map<K,V>getAll(Map<? extends K,? extends Future<? extends V>> futures)Gets all of the results of the futures, returning a modifiable map of the results.static <K,V,M extends Map<K,V>>
MgetAll(Map<? extends K,? extends Future<? extends V>> futures, M output)Gets all of the results of the futures into the provided map.static voidwaitForAll(Iterable<? extends Future<?>> futures)Waits for all futures to complete, discarding any results.
-
-
-
Method Detail
-
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:
InterruptedExceptionExecutionException
-
getAll
public static <K,V> Map<K,V> getAll(Map<? extends K,? extends Future<? extends V>> futures) throws InterruptedException, ExecutionException
Gets 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 extends Map<K,V>> M getAll(Map<? extends K,? extends Future<? extends V>> futures, M output) throws InterruptedException, ExecutionException
Gets all of the results of the futures into the provided map.- Returns:
- the map that was given
- Throws:
InterruptedExceptionExecutionException
-
-