RFR: 8265261: java/nio/file/Files/InterruptCopy.java fails with java.lang.RuntimeException: Copy was not interrupted [v3]
Daniel Fuchs
dfuchs at openjdk.java.net
Fri Aug 20 08:55:29 UTC 2021
On Fri, 20 Aug 2021 01:28:45 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: Make multiple attempts to interrupt and cancel
test/jdk/java/nio/file/Files/InterruptCopy.java line 92:
> 90: // at a fixed rate after a delay
> 91: final Thread me = Thread.currentThread();
> 92: Future<?> wakeup = pool.scheduleAtFixedRate(new Runnable() {
Is it really a good idea? The interrupted state should stick to the thread until it is cleared. It should not really matter if you interrupt the thread too early - but if you interrupt the thread *again* after the File copy was interrupted, won't it skew the logic in the test? Especially WRT double checking that the interrupt status was/wasn't cleared? Also shouldn't you cancel this wakeup at some point before testing cancel below?
-------------
PR: https://git.openjdk.java.net/jdk/pull/5154
More information about the nio-dev
mailing list