Future Interface
Explore the Future interface in Java to understand how it represents asynchronous computation results, supports task cancellation, and enables status polling. This lesson helps you work with Callable tasks and futures, manage blocking and polling for task completion, and introduces the FutureTask implementation.
We'll cover the following...
Future Interface
The Future interface is used to represent the result of an asynchronous computation. The interface also provides methods to check the status of a submitted task and also allows the task to be cancelled if possible. Without further ado, let's dive into an example and see how callable and future objects work in tandem. We'll continue with our sumTask example from the previous lesson.
Thread pools implementing the ExecutorService return a future for their task submission ...