Customizing tasks running in the Fork/Join framework

The Executor framework separates the task creation and its execution. With it, you only have to implement the Runnable objects and use an Executor object. You send the Runnable tasks to the executor and it creates, manages, and finalizes the necessary threads to execute those tasks.

Java 7 provides a special kind of executor in the Fork/Join framework. This framework is designed to solve those problems that can be broken into smaller tasks using the divide and conquer technique. Inside a task, you have to check the size of the problem you want to resolve and, if it's bigger than an established size, you divide the problem in two or more tasks and execute those tasks using the framework. If the ...

Get Java 7 Concurrency Cookbook now with O’Reilly online learning.

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