RFR: 8260366: ExtendedSocketOptions <clinit> can deadlock in some circumstances [v2]

Jaikiran Pai jpai at openjdk.java.net
Thu Feb 18 01:11:41 UTC 2021


On Wed, 17 Feb 2021 20:01:17 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:

>> Jaikiran Pai has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - Incorporate the review suggestion to run the test multiple times to improve the chances of reproducing any potential deadlock
>>  - Incorporate the review suggestion to use @modules instead of --add-exports option while launching the test
>>  - Fix copyright message on test
>
> src/java.base/share/classes/sun/net/ext/ExtendedSocketOptions.java line 171:
> 
>> 169: 
>> 170:     public static ExtendedSocketOptions getInstance() {
>> 171:         if (instance != null) {
> 
> May be it's worth to avoid reading `volatile` field twice?

Hello @turbanoff, do you mean why read it twice - once here and once inside the `synchronized` block?

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

PR: https://git.openjdk.java.net/jdk/pull/2601


More information about the net-dev mailing list