davsclaus opened a new pull request, #26990: URL: https://github.com/apache/camel/pull/26990
Fixes [CAMEL-25089](https://issues.apache.org/jira/browse/CAMEL-25089): bugs found in a deep review of the clustering support (camel-cluster, the cluster service support in camel-support, and the file lock cluster service in camel-file). ## Fixed 1. `FileLockClusterView` now tells its listeners that the leadership is lost when it is stopped while it is the leader. This covers the `stopView` JMX operation, stopping the cluster service, and stopping the clustered route controller. Before, the clustered routes and `master` consumers kept running while the lock was released, so another member took over and both members ran the routes. 2. The JMX operations of `ManagedClusterService` now use the service of the mbean. Before, they looked a service up with the default selector, which finds nothing when there is more than one cluster service. 3. `ClusteredRouteController.setClusterServiceSelector` null-checked the wrong field and always failed. The policies it creates now also use the selector. 4. `ClusteredRoutePolicy` now honours `initialDelay` when the leadership is taken after the CamelContext has started, which is common with the file lock service. 5. `ClusteredRoutePolicy` no longer keeps a removed route, so a shared policy no longer stops or starts a later route that reuses its id. 6. `AbstractCamelClusterService.doStart` now starts only the views that are still in use. 7. `FileLockClusterView` failed with `/ by zero` when `acquireLockInterval` was less than 1 ms. It now rejects such a value with a clear error. 8. `InternalServiceManager.hasServices` now keeps the order the services were added in, so the `first`, type and attribute cluster service selectors are deterministic. There is an upgrade guide entry for 1, 4 and 7. ## Not changed - The policy created per route by `ClusteredRoutePolicyFactory` / `ClusteredRouteController` (its notifier, thread pool and service) is only cleaned up when the CamelContext shuts down, not when its route is removed. A shared policy can be reused by a route added later, so this needs its own change. - Clustered routes do not start again after a CamelContext stop/start. ## Tests - New tests, each of which fails without the fix: - `ClusteredEdgeCasesTest` (camel-core): initial delay, reused route id, service restart, controller selector. - `ManagedClusterServiceTest` (camel-management). - `FileLockClusterViewStopTest` (camel-master): stopView of the leader, interval below 1 ms. - The full suites of camel-core (7769 tests), camel-management (496) and camel-master (32) pass, run with `-am` so the build uses current sources rather than older jars. _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]
