f1amingo opened a new pull request, #10388: URL: https://github.com/apache/rocketmq/pull/10388
### Which Issue(s) This PR Fixes Fixes #10387 ### Brief Description `ClientEventSet` in `LiteEventDispatcher` previously used a fixed-capacity `LinkedBlockingQueue` whose size was bound at construction time, which meant the broker had to be restarted whenever `maxClientEventCount` was changed. `isLowWaterMark()` also relied on `remainingCapacity()`, so its calculation reflected the static bound rather than the intended dynamic limit. This PR refactors `ClientEventSet` to use a logically unbounded queue with a dynamic soft-cap enforced in `offer()`: - Construct the queue as `new LinkedBlockingQueue<>(Integer.MAX_VALUE)` so capacity is never fixed at construction time. - Introduce `getMaxCapacity()` that returns the latest `LiteMetadataUtil.getMaxClientEventCount(group, brokerController)` on every call. - In `offer()`, reject the event when `events.size() >= getMaxCapacity()` instead of relying on `remainingCapacity() == 0`. - In `isLowWaterMark()`, compute the watermark from the dynamic `maxCapacity` directly and guard `maxCapacity <= 0` to avoid division-by-zero. Behavior is functionally equivalent to the previous fixed-cap approach while allowing `maxClientEventCount` to take effect at runtime without a broker restart. ### How Did You Test This Change? - Updated `LiteEventDispatcherTest` to use `doReturn(...).when(spy)...` instead of `when(spy.method()).thenReturn(...)` for spied `ClientEventSet` methods, avoiding real method invocation on the spy. - Existing `LiteEventDispatcherTest` cases covering `offer`, `isLowWaterMark`, and dispatch flow continue to pass locally. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
