Class AsyncFutures

java.lang.Object
com.alibaba.dashscope.resources.AsyncFutures

public final class AsyncFutures extends Object
Bridges synchronous service methods onto an Executor for the async resource tree.

Unlike a bare CompletableFuture.supplyAsync(supplier, executor), executor saturation (the bounded default pool rejecting the task) fails the returned future instead of throwing RejectedExecutionException synchronously on the caller thread, keeping the async API's "errors arrive through the future" contract.

  • Method Details

    • supplyAsync

      public static <T> CompletableFuture<T> supplyAsync(Supplier<T> supplier, Executor executor)
      Runs supplier on executor, mirroring CompletableFuture.supplyAsync(supplier, executor) except that executor rejection fails the returned future instead of throwing synchronously.