On Wed, 22 Feb 2023 18:02:46 GMT, Alan Bateman <[email protected]> wrote:
>> src/java.base/share/classes/java/util/concurrent/Executors.java line 844:
>>
>>> 842: @Override
>>> 843: public void shutdown() {
>>> 844: cleaner.clean();
>>
>> Hmmm... so now shutdown no longer requires permission. You should probably
>> call super.shutdown() before invoking cleaner.clean(), assuming that
>> shutdown() can be called twice. You could modify the cleanup action to only
>> call shutdown() if isShutdown() returns false.
>
>> Hmmm... so now shutdown no longer requires permission. You should probably
>> call super.shutdown() before invoking cleaner.clean(), assuming that
>> shutdown() can be called twice. You could modify the cleanup action to only
>> call shutdown() if isShutdown() returns false.
>
> You are right. It will be a non-issue once the SM goes away but while that
> execution mode is supported then the shutdown method and the cleaner action
> have to be different (as it was initially).
The cleaning action would not have access to the isShutdown() instance method
of the (Phantom-reachable) AutoShutdownDelegatedExecutorService.
-------------
PR: https://git.openjdk.org/jdk/pull/12675