davsclaus opened a new pull request, #24711: URL: https://github.com/apache/camel/pull/24711
## Summary Fixes [CAMEL-24065](https://issues.apache.org/jira/browse/CAMEL-24065). `EventComponent.endpoints` was a plain `LinkedHashSet` iterated by `onApplicationEvent()` and mutated by `consumerStarted()`/`consumerStopped()` without synchronization, causing `ConcurrentModificationException` when a `spring-event` route is stopped while events are dispatched. - Replace `LinkedHashSet` with `CopyOnWriteArraySet` — ideal for this write-rare, read-frequent pattern - Fix premature endpoint removal in `EventEndpoint.consumerStopped()` — only remove the endpoint from the component's set when the load balancer has no processors left, preventing a surviving consumer from silently losing events ## Test plan - [x] New `EventComponentConcurrencyTest.stoppingRouteDuringEventDispatchMustNotThrow` — verifies no exception when stopping a route during event dispatch (the reported bug) - [x] New `EventComponentConcurrencyTest.survivingEndpointStillReceivesEventsAfterAnotherIsStopped` — verifies that remaining endpoints still receive events after another is stopped - [x] Existing `EventRouteTest` passes _Claude Code on behalf of davsclaus_ -- 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]
