The thread-per-task-executor returned by Executors.newVirtualThreadPerTaskExecutor will terminate without waiting for threads that are still executing cancelled tasks. This is different to ThreadPoolExecutor and ForkJoinPool that wait for the threads to finish executing the cancelled tasks. Note that issue with TPTE is specific to Callable tasks, Runnable tasks are not impacted. The change is to override FutureTask.run instead of FutureTask.done. Test coverage is expanded to cover this case.
------------- Commit messages: - Merge branch 'master' into JDK-8347039 - Add asserts to check Future state - Fix typo in comment - Merge branch 'master' into JDK-8347039 - Initial commit Changes: https://git.openjdk.org/jdk/pull/23036/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23036&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8347039 Stats: 66 lines in 2 files changed: 54 ins; 2 del; 10 mod Patch: https://git.openjdk.org/jdk/pull/23036.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/23036/head:pull/23036 PR: https://git.openjdk.org/jdk/pull/23036