RFR: 8285956: (fs) Excessive default poll interval in PollingWatchService [v3]

Tyler Steele duke at openjdk.java.net
Mon May 2 20:56:05 UTC 2022


On Mon, 2 May 2022 19:54:07 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Tyler Steele has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Adds suggested changes to comment
>
> src/java.base/share/classes/sun/nio/fs/PollingWatchService.java line 118:
> 
>> 116: 
>> 117:         // Extended modifiers may be used to specify the sensitivity level
>> 118:         int sensitivity = 1;
> 
> Perhaps a (static final) constant such as `DEFAULT_SENSITIVITY` should be defined and used here and at line 311?

Agreed :-)

> src/java.base/share/classes/sun/nio/fs/PollingWatchService.java line 311:
> 
>> 309:                 Runnable thunk = new Runnable() { public void run() { poll(); }};
>> 310:                 this.poller = scheduledExecutor
>> 311:                     .scheduleAtFixedRate(thunk, 1 /*init wait*/, period, TimeUnit.SECONDS);
> 
> Maybe delete this `/*init wait*/` embedded comment and change the comment at line 308 to something like
> ```// create the periodic task with initialDelay set to the default sensitivity```? (The hard-coded 1 would of course be changed to the new constant.)

Good suggestion. Thanks!

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

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


More information about the nio-dev mailing list