RFR: 8289385: Cleanup redundant synchronization in Http2ClientImpl

Daniel Fuchs dfuchs at openjdk.org
Wed Jun 29 15:08:51 UTC 2022


On Tue, 28 Jun 2022 18:44:38 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

> Http2ClientImpl.stopping and Http2ClientImpl.failures are always accessed under synchronized(this).
> So we can remove 'volatile' modifier from 'stopping'. And remove 'synchronizedSet' wrapper from 'failures'

src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java line 59:

> 57: 
> 58:     private final HttpClientImpl client;
> 59:     private boolean stopping;

before this line and before line 68 - could you please add a comment that says:

// only accessed from within synchronized blocks


Otherwise it looks reasonable to me.

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

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


More information about the net-dev mailing list