O'Reilly logo

Java 7 Concurrency Cookbook by Javier Fernández González

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing the ThreadFactory interface to generate custom threads for the Fork/Join framework

One of the most interesting features of Java 7 is the Fork/Join framework. It's an implementation of the Executor and ExecutorService interfaces that allow you the execution of the Callable and Runnable tasks without managing the threads that execute them.

This executor is oriented to execute tasks that can be divided into smaller parts. Its main components are as follows:

  • A special kind of task, implemented by the ForkJoinTask class.
  • Two operations for dividing a task into subtasks (the fork operation) and to wait for the finalization of those subtasks (the join operation).
  • An algorithm, denominating the work-stealing algorithm, that optimizes the use ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required