allthingssecurity commented on PR #27524: URL: https://github.com/apache/camel/pull/27524#issuecomment-6055379390
Thanks @ranchauh, fair point. Two things the coarse lock costs less than it seems: - Route creation and start were already serialized before this PR: `DefaultModel.addRouteDefinitions` holds the model lock while it creates and starts the routes (`startRouteDefinitions`). So for hundreds of iFlows the bulk of the work never ran in parallel; the new lock only adds waiting for the XML parsing that could overlap. - Swapping the collections alone would remove the exceptions but not the races: the XML loader's delayed beans are shared across updates by design (a bean can depend on a bean of another resource), so with concurrent lists one update can still register another update's bean; `SimpleRegistry` is a `LinkedHashMap` subclass by API; and the model has more unlocked lists (route configurations, transformers, validators). I'd keep this PR as the correctness fix and do the parallel part as a follow-up: parse and pre-parse each resource outside the lock (with the delayed beans tracked per update instead of per loader), and lock only the registration and `addRouteDefinitions` step. If you can share where the time goes in your deployments (XML parsing vs route start), that would tell us how much the follow-up would gain. Happy to open a ticket for it. _Claude Code on behalf of allthingssecurity_ -- 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]
