In this recipe, you implemented the MyWorkerTask class that extends the ForkJoinTask class. It's your own base class to implement tasks that can be executed in a ForkJoinPool executor and that can take advantage of all the benefits of the executor, as it's a work-stealing algorithm. This class is equivalent to the RecursiveAction and RecursiveTask classes.
When you extend the ForkJoinTask class, you have to implement the following three methods:
- setRawResult(): This method is used to establish the result of the task. As your tasks don't return any results, leave this method empty.
- getRawResult(): This method is used to return the result of the task. As your tasks don't return any results, this method returns null.
- exec() ...