davsclaus opened a new pull request, #26959: URL: https://github.com/apache/camel/pull/26959
Fixes [CAMEL-25065](https://issues.apache.org/jira/browse/CAMEL-25065): two bugs in how camel-management registers MBeans (`JmxManagementLifecycleStrategy`), found in a deep review. Each has a test that fails without the fix. 1. **The statistics of a processor MBean stop updating after its route is stopped and started.** Since 4.14 (CAMEL-22312) stopping a route keeps its processor MBeans. When the route was started again, a new managed object was created for each processor and set as the counter of its instrumentation, but it was never registered (the MBean already was) — so exchanges were counted on an object nobody can see, and the registered MBean kept its old numbers (also in `dumpRouteStatsAsXml`, `camel get processor` and the TUI). The managed object of a processor is now kept and reused when its route starts again (`ManagedProcessorStatisticsAfterRouteRestartTest`). 2. **With `mbeansLevel=ContextOnly` the statistics of the CamelContext MBean stay at 0.** A route's exchanges were only counted on the CamelContext MBean through the route MBean, which is not registered with ContextOnly (nor for routes left out by `registerNewRoutes` / `registerRoutesCreateByTemplate`). Such routes are now counted on the CamelContext MBean (`ManagedContextOnlyStatisticsTest`). **Not changed (for a later look)** - A CamelContext name (or management name pattern) with `, = : " * ?` fails to start, as the context key of the object names is not quoted (every query that builds the context key would have to change too). - A context-scoped `onException` is one definition in every route, so its processors share one MBean, which is unregistered when one of the routes is removed. - Two endpoints that only differ in a masked secret get the same object name; removing one unregisters the other's MBean. - Thread pools created by the same source (such as the aggregate's recover and timeout checkers) get the same object name. - Components are registered with `mbeansLevel=ContextOnly`. The whole `camel-management` and `camel-core` test suites pass (the known flaky file-reload test passed on rerun). _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
