On Fri, 10 Jan 2025 14:16:44 GMT, Viktor Klang <vkl...@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.
>
> test/jdk/java/util/concurrent/ThreadPerTaskExecutor/ThreadPerTaskExecutorTest.java
>  line 306:
> 
>> 304:             stop.await();
>> 305:             return null;
>> 306:         });
> 
> One (additional?) option would be to obtain a reference to the returned 
> Future from submit and assert that the Future isn't done after shutdown() 
> returns.

Done but I don't want to too far with adding tests for Future methods in these 
test methods, only because the testAwaitTerminationXXX methods are for 
awaitTermination.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23036#discussion_r1911923157

Reply via email to