RFR: 8365065: cancelled ForkJoinPool tasks no longer throw CancellationException

Alan Bateman alanb at openjdk.org
Mon Sep 22 17:45:05 UTC 2025


On Mon, 22 Sep 2025 15:32:30 GMT, Viktor Klang <vklang at openjdk.org> wrote:

> ForkJoinTask::get and ForkJoinTask::get(timeout, timeunit) now (again) throws CancellationException when cancelled.

test/jdk/java/util/concurrent/tck/ForkJoinPoolTest.java line 524:

> 522:             try {
> 523:                 t.set(Thread.currentThread());
> 524:                 c.await();

Using CountDownLatch is a bit subtle here, maybe a Thread.sleep(Duration.ofDays(1)) might be clearer. It doesn't matter what indefinite wait is used but for the CountDownLatch::await then it might need a comment as readers will look around for the call to countDown.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27430#discussion_r2369598483


More information about the core-libs-dev mailing list