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

Jaikiran Pai jpai at openjdk.org
Wed May 24 11:55:59 UTC 2023


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

>> src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java line 218:
>> 
>>> 216:         synchronized (this) {
>>> 217:             previousExchange = this.exchange;
>>> 218:             this.exchange = exchange;
>> 
>> There's a behavioural change here as compared to before this change. Previously, we used to first call `released()` on the old exchange and `cancel()` the new exchange, before setting the `this.exchange` to the new exchange. Now, with this change, we first switch the `this.exchange` to the new exchange and then call `released()` and `cancel()`. Do you think that could have any (odd) issues?
>
> Good observation. When we reach here the previous exchange is practically terminated. Looking at the implementation of released(), and at the place where `setExchange` is called, I don't think it matters.

Thank you Daniel for checking.

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

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


More information about the net-dev mailing list