CompletableFuture — Aggregate Future to Fail Fast
I have been using the CompletableFuture.allOf(...) helper to create aggregate futures that will only become "done" when their composite futures are marked as complete, i.e: CompletableFuture<?> future1 = new CompletableFuture<>(); CompletableFuture<?> future2 = new CompletableFuture<>(); CompletableFuture<?> future3 = new CompletableFuture<>(); CompletableFuture<?> future = CompletableFuture.allOf(future1, future2, future3); I would like a slight variation on this functionality, where the aggregate future is market as complete when: All futures have completed successfully OR Any one future has