Example code to use Java CompletableFuture