Skip to content

Instantly share code, notes, and snippets.

Created April 26, 2020 13:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
private static void demoCompleteExceptionally() throws InterruptedException, ExecutionException {
CompletableFuture<String> completableFutureFirst = CompletableFuture.supplyAsync(() -> {
System.out.println("Task Running inside completable Future");
try {
} catch (InterruptedException e) {
return "oops";
completableFutureFirst.completeExceptionally(new RuntimeException("Task in CompletableFuture Failed"));
String result = completableFutureFirst.get();
System.out.println("Result :: "+result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment