CompletableFuture in Support of Asynchronous Processing

The java.util.concurrent.CompletableFuture<T> class was first introduced in Java 8. It is the next level of asynchronous call control over java.util.concurrent.Future<T> interface. It actually implements Future, as well as java.util.concurrent.CompletionStage<T>. In Java 9, CompletableFuture was enhanced by adding new factory methods, support for delays and timeouts, and improved subclassing--we will discuss these features in more details in the sections to follow. But first, let's have an overview of the CompletableFuture API.

The CompletableFuture API Overview

The CompletableFuture API consists of more than 70 methods, 38 of which are implementations of the CompletionStage interface, and ...

Get Java: High-Performance Apps with Java 9 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.