6979009: (fc) FileChannel.read() fails to throw ClosedByInterruptException

Xueming Shen xueming.shen at oracle.com
Tue Nov 9 10:54:35 PST 2010

On 11/09/2010 10:48 AM, Alan Bateman wrote:
> Xueming Shen wrote:
>> :
>> You are invoking "close()" directly in this case when interrupted, 
>> instead of
>> "marking" it closed as we do in all other cases. This might be a good 
>> thing to
>> do as the spec says "the interruped channel to be closed" (release 
>> file lock,
>> native resource...), but make the "transferToTrustChannel" special.
> This is the transferTo case where the target is a FileChannel and the 
> interrupt closes the target channel. In that case we can't have 
> transferTo throw ClosedByChannelException but leave the channel open 
> (channel here is the source channel). I realize this isn't pretty but 
> I don't think we have another solution at the moment. There is further 
> work to get asynchronous close and interrupt close working with the 
> transfer method, these issue have been there since 1.4.
> -Alan.


More information about the nio-dev mailing list