public void execute() {
try {
CompletableFuture<?>[] futures =
Arrays.stream(CardJobEnum.values())
.map(e -> CompletableFuture.runAsync(() -> handle(e)))
.collect(Collectors.toSet()).toArray(CompletableFuture[]::new);
CompletableFuture.allOf(futures).get();
} catch (Exception e) {
......
}
}
网友评论