On Tue, 21 Feb 2023 15:45:17 GMT, Viktor Klang <d...@openjdk.org> wrote:

>> Executors.newSingleThreadExecutor returns a delegating ExecutorService that 
>> has finalizer to shutdown the underlying TPE when the wrapper is 
>> finalizable. It goes back to JDK 6 and JDK-6399443. This is the last 
>> non-empty finalizer in java.base. Removing it will likely lead to bug 
>> reports/complaints as the current behavior goes back to 2006. So the 
>> proposal is to just replace it with a Cleaner, trivially done in this case. 
>> As part of the changes, I've replaced the existing test with a more modern 
>> test that exercises more scenarios.
>
> test/jdk/java/util/concurrent/Executors/AutoShutdown.java line 133:
> 
>> 131:         while (!terminated) {
>> 132:             System.gc();
>> 133:             terminated = executor.awaitTermination(100, 
>> TimeUnit.MILLISECONDS);
> 
> @AlanBateman Perhaps worth having some upper limit as to how long it will 
> wait until failing the test?

jtreg will look after this. The default timeout is 120s but it can be adjusted 
with a timeout factor (make time uses a timeout factor of 4). So it would be 
possible to put a limit on this in the test but it can be problematic, e.g. 
with debug builds + Xcomp for example.

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

PR: https://git.openjdk.org/jdk/pull/12675

Reply via email to