6979009: (fc) FileChannel.read() fails to throw ClosedByInterruptException
Xueming Shen
xueming.shen at oracle.com
Tue Nov 9 10:46:06 PST 2010
On 11/09/2010 09:46 AM, Xueming Shen wrote:
>
>
> 463 } catch (ClosedByInterruptException e) {
> 464 // target closed by interrupt as
> ClosedByInterruptException needs
> 465 // to be thrown after closing this channel.
> 466 assert !target.isOpen();
> 467 try {
> 468 close();
> 469 } catch (IOException ignore) {
> 470 // nothing we can do
> 471 }
> 472 throw e;
>
>
> 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.
>
> Otherwise, the change looks good.
>
> -Sherman
>
I took a second look of AbstractInterruptibleChannel.close(), it appears
invoking
"close()" directly here does not make any difference as what is done in
"begin()".
So ignore my above comment.
Approved.
-Sherman
More information about the nio-dev
mailing list