pjfanning opened a new pull request, #2766: URL: https://github.com/apache/pekko/pull/2766
part of #2730 Recency-based passivation strategies (the new default) call `System.nanoTime()` on every message. This introduces a `ScheduledClock` that refreshes the timestamp on a configurable interval (default 1s) and increments a counter between updates — eliminating per-message `nanoTime` calls under high throughput. ### New: `Clock` actor extension (`org.apache.pekko.util`) - `Clock` — `Extension` trait with `currentTime(): Long` and `earlierTime(duration): Long` - `NanoClock` — direct `System.nanoTime()` delegate (used when `scheduled-clock-interval = 0`) - `ScheduledClock` — updates via scheduler at the configured interval; increments atomically between updates so time never goes backwards ### Config ```hocon pekko.scheduled-clock-interval = 1 s # set to 0 to use System.nanoTime() directly ``` ### Internal API changes - `RecencyList` — removed inner `Clock`/`NanoClock`; added `apply(clock: Clock)` factory - `FrequencyList.withOverallRecency.empty` and `SegmentedRecencyList.withOverallRecency.empty` — now take an explicit `Clock` parameter instead of constructing a `NanoClock` internally - `EntityPassivationStrategy.apply` — signature changed to accept `clock: () => Clock`; all strategy and replacement-policy constructors propagate the clock - `Shard` — passes `() => Clock(context.system)` to `EntityPassivationStrategy` - `Simulator` — updated to pass clock factory through to all strategy creators ### Tests - `TestClock` — shared controlled clock extracted from per-spec companion objects - `ScheduledClockSpec` — covers scheduled update, per-call increment, and non-regression (time never decreases under concurrent access) - Passivation specs — replaced `System.nanoTime()` with `clock.currentTime()` for consistency; test config sets `pekko.scheduled-clock-interval = 100 ms` -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
