类 FutureUtils

java.lang.Object
cn.taketoday.util.concurrent.FutureUtils

public abstract class FutureUtils extends Object
Convenience utilities for working with Future and implementations.
从以下版本开始:
4.0
作者:
Arjen Poutsma
  • 构造器详细资料

    • FutureUtils

      public FutureUtils()
  • 方法详细资料

    • callAsync

      public static <T> CompletableFuture<T> callAsync(Callable<T> callable)
      Return a new CompletableFuture that is asynchronously completed by a task running in the ForkJoinPool.commonPool() with the value obtained by calling the given Callable.
      参数:
      callable - a function that returns the value to be used, or throws an exception
      返回:
      the new CompletableFuture
      另请参阅:
    • callAsync

      public static <T> CompletableFuture<T> callAsync(Callable<T> callable, Executor executor)
      Return a new CompletableFuture that is asynchronously completed by a task running in the given executor with the value obtained by calling the given Callable.
      参数:
      callable - a function that returns the value to be used, or throws an exception
      executor - the executor to use for asynchronous execution
      返回:
      the new CompletableFuture
      另请参阅:
    • toSupplier

      private static <T> Supplier<T> toSupplier(Callable<T> callable, CompletableFuture<T> result)