RFR: 8339850: Restore the interrupt status in FileSystemPreferences.lockFile() [v2]

sbgoog duke at openjdk.org
Mon Sep 30 14:31:52 UTC 2024


On Mon, 30 Sep 2024 14:06:35 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> The status might not be explicitly checked, but setting the interrupted status will make sure that subsequent calls to sleep/await/tryLock etc. will not block.
>> 
>> In general, we want to preserve the interrupted status until either the user decides that it's fine to clear, or until the thread dies.
>
> In which case the code might be simplified to just:
> 
>             } catch (InterruptedException e) {
>                 // Don't lose the interrupt
>                 Thread.currentThread().interrupt();
>                 break;
>             }

I've reworked the change to always set the interrupted status. I wouldn't remove the check of the error code here, as it'd be a behavior change. I can follow up with that, though it seems to me that it's good to still have the check for access error here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20938#discussion_r1781250726


More information about the core-libs-dev mailing list