On Wed, 11 Oct 2023 13:07:08 GMT, Doug Lea <d...@openjdk.org> wrote: >> Addresses Jdk 8288899 : java/util/concurrent/ExecutorService/CloseTest.java >> failed with "InterruptedException: sleep interrupted" and related issues. >> >> This is a major ForkJoin update (and hard to review -- sorry) that finally >> addresses incompatibilities between ExecutorService and ForkJoinPool (which >> claims to implement it), with the goal of avoiding continuing bug reports >> and incompatibilities. Doing this required reworking internal control to use >> phaser/seqlock-style versioning schemes (affecting nearly every method) that >> ensure consistent data structures and actions without requiring global >> synchronization or locking on every task execution that would massively >> degrade performance. The previous lack of a solution to this was the main >> reason for these incompatibilities. > > Doug Lea has updated the pull request incrementally with one additional > commit since the last revision: > > More cleanup
src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 3153: > 3151: public <T> ForkJoinTask<T> submit(Callable<T> task) { > 3152: ForkJoinTask<T> t = > 3153: (Thread.currentThread() instanceof ForkJoinWorkerThread) ? @DougLea Won't we need to check if the submitting thread belongs to the same pool here? src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 3324: > 3322: poolSubmit(true, f); > 3323: } > 3324: for (int i = futures.size() - 1; i >= 0; --i) @DougLea Might not be necessary for performance, but using an ArrayDeque and using `pollLast()` might be cleaner? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14301#discussion_r1356855770 PR Review Comment: https://git.openjdk.org/jdk/pull/14301#discussion_r1356859056