RFR: 8372159: HttpClient SelectorManager thread could be a VirtualThread [v5]

Daniel Jeliński djelinski at openjdk.org
Mon Nov 24 11:58:32 UTC 2025


On Thu, 20 Nov 2025 12:21:42 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Each HttpClient instance creates an additional platform thread for its SelectorManager. With recent updates to NIO/VirtualThreads that thread could now become a VirtualThread. This would avoid having each HttpClient instance use up one platform thread.
>> This is similar to what was done for the HttpClient QuicSelectorThread in [JDK-8369920](https://bugs.openjdk.org/browse/JDK-8369920).
>> This should be transparent for users of the API. 
>> An undocumented internal system property is introduced that can revert the change in case of unforeseen trouble.
>
> Daniel Fuchs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - 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

Marked as reviewed by djelinski (Reviewer).

test/jdk/java/net/httpclient/http3/H3QuicVTTest.java line 201:

> 199:     // This method attempts to determine whether the quic selector thread
> 200:     // is a platform thread or a virtual thread, and throws if expectations
> 201:     // ar not met.

Suggestion:

    // are not met.

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

PR Review: https://git.openjdk.org/jdk/pull/28395#pullrequestreview-3500030651
PR Review Comment: https://git.openjdk.org/jdk/pull/28395#discussion_r2556019530


More information about the net-dev mailing list