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

Daniel Fuchs dfuchs at openjdk.org
Thu May 18 10:04:10 UTC 2023


> 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 three additional commits since the last revision:

 - Update src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java
   
   Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
 - Update src/java.net.http/share/classes/jdk/internal/net/http/ConnectionPool.java
   
   Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
 - Update test/jdk/java/net/httpclient/AuthFilterCacheTest.java
   
   Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/14038/files
  - new: https://git.openjdk.org/jdk/pull/14038/files/889122f0..e090e36e

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=14038&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14038&range=00-01

  Stats: 3 lines in 3 files changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/14038.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14038/head:pull/14038

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


More information about the net-dev mailing list