RFR: 8265261: java/nio/file/Files/InterruptCopy.java fails with java.lang.RuntimeException: Copy was not interrupted [v2]
Brian Burkhalter
bpb at openjdk.java.net
Thu Aug 19 20:47:28 UTC 2021
On Thu, 19 Aug 2021 01:06:47 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> This proposal suggests to change the timing of testing whether a file copy is terminated by an interrupt.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8265261: Fix the section which tests cancellation
It looks like the duration threshold `DURATION_MAX_IN_MS` was added in the change which resolved [JDK-6993267](https://bugs.openjdk.java.net/browse/JDK-6993267). A comment in that issue is "We should improve the test to work on very fast machines." So the copy must have been too fast for it to be interrupted and without the duration threshold there were spurious failures.
`Thread.interrupted()` in the main thread indeed seems unnecessary.
I think a further look at the semantics, as suggested, is in order.
It looks like the duration threshold `DURATION_MAX_IN_MS` was added in the change which resolved [JDK-6993267](https://bugs.openjdk.java.net/browse/JDK-6993267). A comment in that issue is "We should improve the test to work on very fast machines." So the copy must have been too fast for it to be interrupted and without the duration threshold there were spurious failures.
`Thread.interrupted()` in the main thread indeed seems unnecessary.
I think a further look at the semantics, as suggested, is in order.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5154
More information about the nio-dev
mailing list