8199015: (se) SocketChannelImpl.translateXXXOps access channel state without synchronization

Alan Bateman Alan.Bateman at oracle.com
Mon Mar 5 13:32:22 UTC 2018


While fixing other issues in this area, I noticed that SocketChannel's 
translateXXXOps methods access the channel state without holding the 
state lock. The issue seems to be there since JDK 1.4. As the 
translateXXXOps methods are called during performance sensitive select 
operations then it seems better to change the state field to volatile 
rather. The other channel implementations don't see to have this issue 
as they need the channel state to translate events. The proposed changes 
are here:
     http://cr.openjdk.java.net/~alanb/8199015/webrev/index.html

-Alan


More information about the nio-dev mailing list