RFR: 8288899: java/util/concurrent/ExecutorService/CloseTest.java failed with "InterruptedException: sleep interrupted" [v49]

Doug Lea dl at openjdk.org
Thu Oct 12 16:56:22 UTC 2023


On Thu, 12 Oct 2023 13:46:01 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> 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?

No, but I can imagine this being the subject of a Puzzler someday, because either choice might be unexpected by someone! To maximize compatibility wrt incompatible specs (initial FJ and ES), calls to submit from workers are by default noninterruptible, even if they are client calls into another pool. The opposite choice might be more defensible but could break existing code.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14301#discussion_r1357116787


More information about the core-libs-dev mailing list