Integrated: 8347039: ThreadPerTaskExecutor terminates if cancelled tasks still running
Alan Bateman
alanb at openjdk.org
Wed Jan 15 10:56:49 UTC 2025
On Fri, 10 Jan 2025 13:32:39 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> 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.
This pull request has now been integrated.
Changeset: af3f5d85
Author: Alan Bateman <alanb at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/af3f5d852e5dd0191548bdc477546b5b343d1276
Stats: 66 lines in 2 files changed: 54 ins; 2 del; 10 mod
8347039: ThreadPerTaskExecutor terminates if cancelled tasks still running
Reviewed-by: vklang
-------------
PR: https://git.openjdk.org/jdk/pull/23036
More information about the core-libs-dev
mailing list