Home » Future

Tag Archives: Future

Java CompletionStage and CompletableFuture Example

1. Introduction Java JDK8 included the big fat interface called CompletionStage in the java.util.concurrent package. The same package also contains CompletableFuture which is a library implementation of CompletionStage. In this post we would see how CompletionStage and CompletableFuture provide piped asynchronous API thus enhancing reactive programming support in Java at the platform level. Since we are talking about JDK8 APIs, ...

Read More »

java.util.concurrent.FutureTask Example

In this example we shall show you how to make FutureTask, FutureTask is an implementation of Future which offers a very elegant way to implement parallel execution of tasks in Java where a big task can be split into small chunks and if each of those chunks can be executed in parallel, it can result in better response times and throughput. We can ...

Read More »

Java ExecutorService Example – Tutorial

Java ExecutorService is an interface that extends Executor class and represents an asynchronous execution. Executor service provides us mechanisms to manage the end and detect progress of the asynchronous tasks. In this example, we are going to see some basic functionalities of ExecutorService, as well as handle the Future object, the result of asynchronous computation. 1. Runnable vs Callable The ...

Read More »