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 and Future interfaces ...

Get Mastering Concurrency Programming with Java 8 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.