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