RFR 8216978: Drop support for pre JDK 1.4 SocketImpl implementations

Daniel Fuchs daniel.fuchs at oracle.com
Mon Apr 29 12:00:08 UTC 2019


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.

best regards,

-- daniel


More information about the net-dev mailing list