RFR: 8265261: java/nio/file/Files/InterruptCopy.java fails with java.lang.RuntimeException: Copy was not interrupted [v3]

Brian Burkhalter bpb at openjdk.java.net
Fri Aug 20 15:44:32 UTC 2021


On Fri, 20 Aug 2021 08:51:23 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: 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?

I was not sure about the fixed rate firing here so you might be right. The wakeup is cancelled by `wakeup.get()` unless I misunderstand.

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

PR: https://git.openjdk.java.net/jdk/pull/5154


More information about the nio-dev mailing list