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 15:35:27 UTC 2021
On Thu, 19 Aug 2021 11:04:05 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8265261: Fix the section which tests cancellation
>
> test/jdk/java/nio/file/Files/InterruptCopy.java line 144:
>
>> 142: else {
>> 143: result.get();
>> 144: throw new RuntimeException("Copy was not cancelled");
>
> Should `DURATION_MAX_IN_MS` be taken into account here too to decide whether to throw or not?
I don't know. It seems like cancellation ought to be a bit more predictable than interruption. I am not sure how `DURATION_MAX_IN_MS` was determined. If there were no "hiccups" in the threads starting, then with the correct timing I am not sure that such a threshold is even needed. The execution time for the copy that I have observed is between 150ms (macOS) and 400ms (Windows) which is a lot less than 5s, so there would have to be some slowdown for this threshold even to be reached.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5154
More information about the nio-dev
mailing list