RFR: 8308310: HttpClient: Avoid logging or locking from within synchronized blocks [v9]

Jaikiran Pai jpai at openjdk.org
Wed May 24 13:15:02 UTC 2023


On Wed, 24 May 2023 11:39:26 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Please find here a change that revisits usage of monitors in the HttpClient.
>> 
>> With Virtual Threads now part of the platform it should be possible to pass a newVirtualThreadPerTaskExecutor to the HttpClient. Logging, when enabled, and when called from a synchronized block, can cause the carrier thread to get pinned in case of contention when printing through the underlying PrintStream.
>> 
>> This change aims at avoiding situations where the carrier threads might get pinned.
>
> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review feedback

The latest changes in `f5986f93` look fine to me. There's just one suggestion that's remaining in the `ConcurrentResponses` test about moving the closing of the client and virtual thread executor in a finally block, but other than that this looks good to me.

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

Marked as reviewed by jpai (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14038#pullrequestreview-1441771566


More information about the net-dev mailing list