Here you can find the source of exceptionallyCompletedFuture( final Throwable e)
Parameter | Description |
---|---|
e | exception for the future |
T | the type of the value of the success case |
public static <T> CompletableFuture<T> exceptionallyCompletedFuture( final Throwable e)
//package com.java2s; //License from project: Apache License import java.util.concurrent.*; public class Main { /**//from w ww. j ava2 s.c o m * Creates a {@link CompletableFuture} which is completed exceptionally with the given Exception. * Alias of {@link #failed(Throwable)}. * * {@include.example io.sphere.sdk.utils.CompletableFutureUtilsTest#testFailed()} * * @param e exception for the future * @param <T> the type of the value of the success case * @return future */ public static <T> CompletableFuture<T> exceptionallyCompletedFuture( final Throwable e) { return failed(e); } /** * Creates a {@link CompletableFuture} which is completed exceptionally with the given Exception. * * {@include.example io.sphere.sdk.utils.CompletableFutureUtilsTest#testFailed()} * * @param e exception for the future * @param <T> the type of the value of the success case * @return future */ public static <T> CompletableFuture<T> failed(final Throwable e) { final CompletableFuture<T> future = new CompletableFuture<>(); future.completeExceptionally(e); return future; } }