Package google.registry.util
Class Concurrent
java.lang.Object
google.registry.util.Concurrent
Utilities for multithreaded operations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <A,
B> com.google.common.collect.ImmutableList <B> transform
(Collection<A> items, int maxThreadCount, Function<A, B> funk) Processesitems
in parallel usingfunk
, with the specified number of threads.static <A,
B> com.google.common.collect.ImmutableList <B> transform
(Collection<A> items, Function<A, B> funk) Runs transform with the default number of threads.
-
Method Details
-
transform
public static <A,B> com.google.common.collect.ImmutableList<B> transform(Collection<A> items, Function<A, B> funk) Runs transform with the default number of threads.- See Also:
-
transform
public static <A,B> com.google.common.collect.ImmutableList<B> transform(Collection<A> items, int maxThreadCount, Function<A, B> funk) Processesitems
in parallel usingfunk
, with the specified number of threads.If the maxThreadCount or the number of items is less than 2, will use a non-concurrent transform.
Note: Spawned threads will inherit the same namespace.
- Returns:
- transformed
items
in the same order. - Throws:
com.google.common.util.concurrent.UncheckedExecutionException
- to wrap the exception thrown byfunk
. This will only contain the exception information for the first exception thrown.
-