public class AsyncUtil extends Object
Constructor and Description |
---|
AsyncUtil() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
get(CompletableFuture<T> task)
获取异步任务结果,包裹了异常
|
static void |
waitAll(CompletableFuture<?>... tasks)
等待所有任务执行完毕,包裹了异常
|
static <T> T |
waitAny(CompletableFuture<?>... tasks)
等待任意一个任务执行完毕,包裹了异常
|
public static void waitAll(CompletableFuture<?>... tasks)
tasks
- 并行任务UndeclaredThrowableException
- 未受检异常public static <T> T waitAny(CompletableFuture<?>... tasks)
T
- 任务返回值类型tasks
- 并行任务UndeclaredThrowableException
- 未受检异常public static <T> T get(CompletableFuture<T> task)
T
- 任务返回值类型task
- 异步任务RuntimeException
- 未受检异常Copyright © 2024. All rights reserved.