On Thu, 18 May 2023 10:04:10 GMT, Daniel Fuchs <[email protected]> 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 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 <[email protected]>
>  - Update 
> src/java.net.http/share/classes/jdk/internal/net/http/ConnectionPool.java
>    
>    Co-authored-by: Andrey Turbanov <[email protected]>
>  - Update test/jdk/java/net/httpclient/AuthFilterCacheTest.java
>    
>    Co-authored-by: Andrey Turbanov <[email protected]>

src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java line 
72:

> 70:     /** Records a possible cancellation raised before any operation
> 71:      * has been initiated, or an error received while sending the 
> request. */
> 72:     private AtomicReference<Throwable> failedRef = new 
> AtomicReference<>();

Seems it's only modified under lock. Can we use `volatile` instead?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14038#discussion_r1197759798

Reply via email to