Java 9 introduces several enhancements to CompletableFuture:
- The CompletionStage<U> failedStage(Throwable ex) factory method returns the CompletionStage object completed with the given exception
- The CompletableFuture<U> failedFuture(Throwable ex) factory method returns the CompletableFuture object completed with the given exception
- The new CompletionStage<U> completedStage(U value) factory method returns the CompletionStage object completed with the given U value
- CompletableFuture<T> completeOnTimeout(T value, long timeout, TimeUnit unit) completes CompletableFuture task with the given T value if not otherwise completed before the given timeout
- CompletableFuture<T> orTimeout(long timeout, ...