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

Xueming Shen xueming.shen at oracle.com
Tue Nov 9 09:46:38 PST 2010

  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.


More information about the nio-dev mailing list