Skip to Content
Java Coding Problems
book

Java Coding Problems

by Anghel Leonard
September 2019
Intermediate to advanced
816 pages
18h 47m
English
Packt Publishing
Content preview from Java Coding Problems

215. Fork/join framework and compareAndSetForkJoinTaskTag()

Now, that we are familiar with the fork/join framework, let's see another problem. This time let's assume that we have a suite of ForkJoinTask objects that are interdependent. The following diagram can be considered a use case:

Here is the description of the preceding diagram:

  • TaskD has three dependencies: TaskA, TaskB, and TaskC.
  • TaskC has two dependencies: TaskA and TaskB.
  • TaskB has one dependency: TaskA.
  • TaskA has no dependencies.

In code lines, we will shape it as follows:

ForkJoinPool forkJoinPool = ForkJoinPool.commonPool();Task taskA = new Task("Task-A", new Adder(1));Task ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Coding Problems - Second Edition

Java Coding Problems - Second Edition

Anghel Leonard
Java in a Nutshell, 7th Edition

Java in a Nutshell, 7th Edition

Benjamin J. Evans, David Flanagan
The Well-Grounded Java Developer, Second Edition

The Well-Grounded Java Developer, Second Edition

Benjamin Evans, Martijn Verburg, Jason Clark

Publisher Resources

ISBN: 9781789801415Supplemental Content