RFR: 8330077: Allow max number of events to be buffered to be configurable to avoid OVERFLOW_EVENT [v5]

Brian Burkhalter bpb at openjdk.org
Mon Apr 15 17:34:42 UTC 2024


On Fri, 12 Apr 2024 07:38:57 GMT, Fabian Meumertzheim <duke at openjdk.org> wrote:

>> The limit on the number of events buffered for a single `j.n.f.WatchKey` is now configurable via the `sun.nio.fs.maxWatchEvents`.
>
> Fabian Meumertzheim has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use SOFT_MAX_ARRAY_LENGTH

An `@implNote` about the property and its behavior could be added in `WatchService`.

Once the property name, its behavior, and the `@implNote` are decided I can file the CSR.

src/java.base/share/classes/sun/nio/fs/AbstractWatchKey.java line 49:

> 47:     static {
> 48:         String rawValue = GetPropertyAction.privilegedGetProperty(
> 49:             "jdk.nio.file.maxWatchEvents",

What about `"jdk.nio.file.WatchService.maxEventsPerPoll"` instead?

src/java.base/share/classes/sun/nio/fs/AbstractWatchKey.java line 57:

> 55:             intValue = Math.clamp(
> 56:                 Long.decode(rawValue),
> 57:                 DEFAULT_MAX_EVENT_LIST_SIZE,

Probably we should allow positive values with no minimum. If it's zero or negative then I am not sure whether that would be an error.

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

PR Comment: https://git.openjdk.org/jdk/pull/18739#issuecomment-2057454337
PR Review Comment: https://git.openjdk.org/jdk/pull/18739#discussion_r1566201273
PR Review Comment: https://git.openjdk.org/jdk/pull/18739#discussion_r1566203428


More information about the nio-dev mailing list