Chapter 7. Optimizing Divide and Conquer Solutions - The Fork/Join Framework
In Chapter 3, Managing Lots of Threads - Executors, Chapter 4, Getting the Most from Executors, and Chapter 5, Getting Data from Tasks - The Callable and Future Interfaces, you learned how to work with executors as a mechanism to improve the performance of concurrent applications that execute lots of concurrent tasks. The Java 7 Concurrency API introduced a special kind of executor through the fork/join framework. This framework is designed to implement optimal concurrent solutions to those problems that can be solved using the divide and conquer design paradigm. In this chapter, we will cover the following topics:
- An introduction to the fork/join framework
- The first example - the k-means clustering algorithm
- The second example - a data filtering algorithm
- The third example - the merge sort algorithm