On Thu, 18 Feb 2021 13:06:44 GMT, Jaikiran Pai <j...@openjdk.org> wrote:

>> Changes requested by dfuchs (Reviewer).
>
> I'm closing this for now, for the reason stated here 
> https://github.com/openjdk/jdk/pull/2601#discussion_r578400669.

After thinking a bit more about this issue and the patch I had proposed, I 
realized what I did wrong in this patch. The `synchronized` block in the 
`sun.net.ext.ExtendedSocketOptions#getInstance()` was scoped one statement too 
many. We don't (and shouldn't) need the 
`Class.forName("jdk.net.ExtendedSocketOptions")` to be part of that 
synchronized block. I've now modified and fixed that part to have the 
synchronized block only at the place where it should be needed. I've also 
enhanced the test to introduce a couple of additional concurrent tasks which 
now call `sun.net.ext.ExtendedSocketOptions#getInstance()`. So in total, the 
test now fires off 4 tasks, 2 of which load the respective classes and the 
other 2 call the getInstance() method, all concurrently. This should make the 
test a bit more robust and should catch any potential deadlocks. With this fix, 
the test now passes.

I've now updated and reopened this PR for further reviews.

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

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

Reply via email to