RFR: 8285956: (fs) Excessive default poll interval in PollingWatchService [v4]
Alan Bateman
alanb at openjdk.java.net
Wed May 4 16:58:34 UTC 2022
On Tue, 3 May 2022 14:05:07 GMT, Tyler Steele <duke at openjdk.java.net> wrote:
>> src/java.base/share/classes/sun/nio/fs/PollingWatchService.java line 253:
>>
>>> 251: private class PollingWatchKey extends AbstractWatchKey {
>>> 252:
>>> 253: private static final int POLLING_INIT_DELAY = 1;
>>
>> Can you move this up to the top of the file so it's with DEFAULT_POLLING_INTERVAL? I thin both will need a short one line comment.
>>
>> I'm not sure about changing it to 1s as it may lead to complaints from macOS users with programs that monitor directories with a large number of files. The right thing is of course to include a native implementation for that platform, some day :-)
>
>> Can you move this up to the top of the file so it's with DEFAULT_POLLING_INTERVAL? I thin both will need a short one line comment.
>
> The constants are used in different objects, so I'm not sure there is a sensible way to to do this. A constant reference to a private object might be a way, but that felt like too much indirection.
>
>> I'm not sure about changing it to 1s as it may lead to complaints from macOS users with programs that monitor directories with a large number of files. The right thing is of course to include a native implementation for that platform, some day :-)
>
> Changed to 2s interval between subsequent polls since there have been a few concerns about this :-). I also agree that a native implementation would be far superior.
I think it would be cleaner to have both constants declared at the top in PollingWatchService. They are in the same nest so accessibility should not be an issue.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8479
More information about the nio-dev
mailing list