CompletableFuture API enhancements

The CompletableFuture<T> class is part of the java.util.concurrent package. This class extends the Object class and implements Future<T> and CompletionStage<T> interfaces. This class is used to annotate threads that can be completed. We can use the CompletableFuture class to represent a future result. When the complete method is used, that future result can be completed.

It is important to realize that if multiple threads attempt to simultaneously complete (finish or cancel), all but one will fail. Let's look at the class and then look at the enhancements.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset