Should java/nio/channels/spi/AbstractInterruptibleChannel.java#isOpen be synchronized ?
Alan.Bateman at oracle.com
Tue Dec 4 06:13:16 PST 2012
On 04/12/2012 10:53, Sean Chou wrote:
> I found AbstractInterruptibleChannel.close() is synchronized
> using closeLock, but isOpen() is not synchronized. Javadoc
> of isOpen() says "Returns: true if, and only if, this channel is
> open". I want to know if isOpen() method is designed not to
> synchronize with closeLock ? Because in close() method the closeLock
> embraces "open = false;" and " implCloseChannel(); " , which looks
> like the open variable should always reflect the real state.
What problem are you running into? I see anything wrong with isOpen and
it would create a lot of issues if it were to synchronize on closeLock.
More information about the nio-dev