RFR: 8372198: Avoid closing PlainHttpConnection while holding a lock [v4]

Daniel Fuchs dfuchs at openjdk.org
Tue Nov 25 10:30:26 UTC 2025


On Tue, 25 Nov 2025 06:38:07 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Daniel Fuchs has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:
>> 
>>  - Merge branch 'master' into ConnectionCloseLock-8372198
>>  - Merge master
>>  - 8372198: Avoid closing PlainHttpConnection while holding a lock
>>  - Merge branch 'master' into SelectorManagerVT-8372159
>>  - Copyright years
>>  - Review feedback on test
>>  - Revert changes to SelectorManager::shutdown
>>  - 8372159: HttpClient SelectorManager thread could be a VirtualThread
>
> src/java.net.http/share/classes/jdk/internal/net/http/ConnectionPool.java line 213:
> 
>> 211:             if (cleanup.isDone()) {
>> 212:                 return;
>> 213:             } else if (stopping = stopped) {
> 
> This is tricky to read. Should we change this to:
> 
> else if (stopped) {
>    stopping = true;
>    ....
> }

Not sure whether it's less tricky or more tricky. It kind of hides the fact that we assign stopping to stopped and that we read stopped (a volatile) only once to prevent reordering tricks that the compiler might play.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28430#discussion_r2559442973


More information about the net-dev mailing list