8238231: Custom DatagramSocketImpl's create method not called when with protected constructor

Daniel Fuchs daniel.fuchs at oracle.com
Fri Jan 31 19:42:50 UTC 2020


On 31/01/2020 17:47, Alan Bateman wrote:
> 
> On 31/01/2020 17:30, Daniel Fuchs wrote:
>> http://cr.openjdk.java.net/~dfuchs/webrev_8238231/webrev.01
> This has the same bug as it reads "created" outside of the synchronized 
> block. If you change it to volatile then it will fix that issue.

I think I disagree but I agree it's non obvious so I will switch
the boolean to volatile.
http://cr.openjdk.java.net/~dfuchs/webrev_8238231/webrev.02

>> It is the same since createImpl() calls impl.create().
> This is confusing for the reader. I think we should keep the comment 
> from the patch attached to the bug and also set "created" to true 
> immediately after calling impl.create(). That will avoid potential 
> confusion on the semantics of the "created" flag. It means that the 
> impl's create method has been called to create the socket, it does not 
> mean that the impl object has been created.

Done.

best regards,

-- daniel

> 
> -Alan



More information about the net-dev mailing list