On Tue, 20 Oct 2026 10:19:20 GMT, Viktor Klang <[email protected]> wrote:

>> This PR ensures that the failing test does not leak threads between each 
>> iteration, which could lead to timeouts.
>> 
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Viktor Klang has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Switch to try-with-resources + respect thread interruption

test/jdk/java/util/concurrent/forkjoin/AsyncShutdownNowInvokeAnyRace.java line 
114:

> 112:             Future<Void> shutdownResult = 
> CompletableFuture.runAsync(shutdown);
> 113: 
> 114:             try (pool) { // Ensure that the pool is terminated after 
> each iteration

Replacing

    try {
        try {
            invokeAny();
        } catch (...) {
            ...
        }
    } finally {
        pool.shutdown();
    }

with

    try (pool) {
       invokeAny();
    } catch (...) {
        ...
    }

has a semantic difference: earlier, `catch` clauses were kicking in right after 
an `invokeAny()` failure; now, `catch` clauses kick in after `pool.close()`, 
which might block due to stale workers, and consequently short-circuit catch 
clauses, e.g., `catch (TimeoutException ...)` might get skipped.

@viktorklang-ora, is this change intentional or harmless?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33453#discussion_r4387529104

Reply via email to