Skip to content

Instantly share code, notes, and snippets.

View remibarat's full-sized avatar

Rémi Barat remibarat

View GitHub Profile
@remibarat
remibarat / TestForkJoin.java
Last active February 13, 2019 04:44
Difference in work stealing between jdk1.8 and jdk11. The following examples work well with jdk1.8 but do not finish with jdk11.
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.RecursiveAction;
/**
* This example uses a Parent task (e.g. mapping in a custom Map when the Map is full) that will
* launch * a Child task (e.g. to resize the Map, we need to rehash it). Any new Parent task needs
* to wait for the Child task to finish. The Child task will also launch Child tasks.
*
* The idea is that, a thread B in a child task C0 `join`s a child task C2 and manages to steal a