Class Concurrent

java.lang.Object
google.registry.util.Concurrent

public final class Concurrent extends Object
Utilities for multithreaded operations.
  • 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)
      Processes items in parallel using funk, 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 by funk. This will only contain the exception information for the first exception thrown.