RFR: 8310902: (fc) FileChannel.transferXXX async close and interrupt issues [v4]

Alan Bateman alanb at openjdk.org
Wed Jun 28 19:46:13 UTC 2023


> This change fixes a number of bugs with FileChannel.transferTo/transerFrom that arise when the source or target channel is closed, or the thread is interrupted, during the transfer. More specifically:
> 
> - The direct implementations operate on the raw file descriptor and don't prevent the target/source channel from being closed during the transfer. For this PR, the direct transferTo is limited to cases where the target is a FileChannel or SocketChannel. It could be extended to other SelChImpl implementations (SinkChannel, DatagramChannel) if needed, but they are less interesting at this time.
> 
> - The transferTo/transferFrom methods are specified to throw ClosedByInterruptException after closing both channels. This is implemented inconsistently, and leaves one channel open in several cases.

Alan Bateman has updated the pull request incrementally with one additional commit since the last revision:

  Cleanup transferToDirectNotSupported/transferFromDirectNotSupported setting

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/14656/files
  - new: https://git.openjdk.org/jdk/pull/14656/files/639372ca..182f8c05

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=14656&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14656&range=02-03

  Stats: 34 lines in 1 file changed: 5 ins; 24 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/14656.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14656/head:pull/14656

PR: https://git.openjdk.org/jdk/pull/14656


More information about the nio-dev mailing list