O'Reilly logo

Java 9 Concurrency Cookbook - Second Edition 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

Processing uncontrolled exceptions in a ForkJoinPool class

The fork/join framework gives you the possibility to set a handler for the exceptions thrown by the worker threads of a ForkJoinPool class. When you work with a ForkJoinPool class, you should understand the difference between tasks and worker threads.

To work with the fork/join framework, you implement a task extending the ForkJoinTask class or, usually, the RecursiveAction or RecursiveTask classes. The task implements the actions you want to execute concurrently with the framework. They are executed in the ForkJoinPool class by the worker threads. A worker thread will execute various tasks. In the work-stealing algorithm implemented by the ForkJoinPool class, a worker thread looks ...

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