Chapter 4. Getting Data from the Tasks – The Callable and Future Interfaces
In Chapter 2, Managing Lots of Threads – Executors, and Chapter 3, Getting the Maximum from Executors, we introduced the executor framework to improve the performance of concurrent applications and showed you how to implement advanced characteristics to adapt this framework to your needs. In these chapters, all the tasks executed by the executor were based on the Runnable
interface and its run()
method that doesn't return a value. However, the executor framework allows us to execute other kind of tasks that return a result based on the Callable
and Future
interfaces. In this chapter, we will cover the following topics:
- An introduction to the
Callable
andFuture
interfaces ...
Get Mastering Concurrency Programming with Java 8 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.