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

How it works...

In this recipe, you implemented a task that increments the elements of an array, using a ForkJoinPool class, and a Task class that extends the RecursiveAction class. This is one of the tasks you can execute in a ForkJoinPool class. When the tasks were processing the array, you printed information about the status of the ForkJoinPool class to the console. You used the following methods to get the status of the ForkJoinPool class:

  • getPoolSize(): This method returns an int value, which is the number of worker threads of the internal pool of a ForkJoinPool class
  • getParallelism(): This method returns the desired level of parallelism established for a pool
  • getActiveThreadCount(): This method returns the number of threads that are ...

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