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

Andrey Turbanov aturbanov at openjdk.org
Thu May 18 14:03:03 UTC 2023


On Thu, 18 May 2023 13:53:01 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> 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?
>
> I prefer to keep AtomicReference - it's easier to reason about.
> Maybe at some time I'll do a pass to use VarHandles in various places but now is not the time.

let's make it `final` at least

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

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


More information about the net-dev mailing list