RFR 8216978: Drop support for pre JDK 1.4 SocketImpl implementations
Alan Bateman
Alan.Bateman at oracle.com
Mon Apr 29 12:24:57 UTC 2019
On 29/04/2019 13:00, Daniel Fuchs wrote:
> Hi Alan,
>
> On 29/04/2019 12:17, Alan Bateman wrote:
>> I don't think AbstractPlainSocketImpl.isBound needs to be volatile as
>> it is guarded by the synchronization on the impl (the doConnect and
>> bind methods are synchronized).
>
> I see that it is set outside of any synchronized block
> in AbstractPlainSocketImpl::bind
>
> 433 protected synchronized void bind(InetAddress address, int lport)
> 434 throws IOException
> 435 {
> 436 synchronized (fdLock) {
> 437 if (!closePending && !isBound) {
> 438 NetHooks.beforeTcpBind(fd, address, lport);
> 439 }
> 440 }
> 441 socketBind(address, lport);
> 442 isBound = true;
>
>
>
> 443 }
>
> which for me justifies that it should be volatile.
I think you are might be mixing up the lock on the vs. fdLock. From what
I can tell, isBound is only accessed by doConnect and bind and they are
both synchronized methods.
-Alan
More information about the net-dev
mailing list