RFR: 8272964: java/nio/file/Files/InterruptCopy.java fails with java.lang.RuntimeException: Copy was not interrupted

Alan Bateman Alan.Bateman at oracle.com
Fri Aug 27 07:08:57 UTC 2021


On 26/08/2021 21:13, Brian Burkhalter wrote:
> :
> The third case however reveals that if the thread which calls `Files.copy()` is interrupted in `runInterruptibly()` on the line _after_ `t.join()`, then the copy succeeds and no `InterruptedException` is thrown. So there is a small window in time between `t.join()` and the return from `Files.copy()` when the interrupt wil be ignored.
I don't immediately see an issue there. A thread can be interrupted at 
any time. If a thread in Files.copy is interrupted after the copy has 
completed but before the method returns then it just means that 
Files.copy will complete (successfully) but with the interrupt status set.

-Alan.






More information about the nio-dev mailing list