RFR: 8285956: (fs) Excessive default poll interval in PollingWatchService [v7]
Thomas Stuefe
stuefe at openjdk.java.net
Wed May 4 16:17:29 UTC 2022
On Tue, 3 May 2022 14:03:17 GMT, Tyler Steele <duke at openjdk.java.net> wrote:
>> PollingWatchService.java contains the WatchService and WatchKey implementation for AIX and BSD. When a Path is [register](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/nio/file/Path.html#register(java.nio.file.WatchService,java.nio.file.WatchEvent.Kind...))ed this implementation creates a polling thread to monitor for file system changes. Currently, this thread waits 10 seconds before it's first poll, and then waits 10 seconds between subsequent polls. This interval leads to sluggish performance.
>>
>> This PR makes the following changes:
>> - Sets the initial interval to 1 second regardless of the period.
>> - Change the default period to 1 second.
>>
>> All tests in `test/jdk/java/nio/file/WatchService` passing.
>
> Tyler Steele has updated the pull request incrementally with one additional commit since the last revision:
>
> Adds comments to polling thread constant values
This looks reasonable to me. I agree the default of 2secs is fine for most scenarios. If someone wants to saturate the Watchservice, he will manage to do that, but as Tyler wrote, it is an obvious problem.
Cheers, Thomas
-------------
Marked as reviewed by stuefe (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/8479
More information about the nio-dev
mailing list