allthingssecurity commented on PR #28645: URL: https://github.com/apache/camel/pull/28645#issuecomment-6490445315
@davsclaus thanks for the review. Changes in 72e4cb0202d9 (one new commit on top): - ProducerTemplate question: a template from `context.createProducerTemplate()` is only started, not registered with the context, so the context does not stop it. But each producer the template creates is a context service: `ServicePool.SinglePool.acquire` calls `camelContext.addService(producer, true, true)`. So `context.stop()` stops the producer, and it releases its reference on the manager, which closes when the endpoints stop too. New test `producerOfAProducerTemplateIsStoppedWithTheContext` (template never stopped; after `context.stop()` the count is 0 and the cache is closed). Its control, a producer that does not release on stop, fails with `expected: <0> but was: <1>`. A producer that the application creates and starts itself without stopping it still holds the manager, as any resource it owns. - `EhcacheEndpoint` ~110: `doStop` now stops the `EhcacheManager` only when its count reaches 0, the same rule as the `doShutdown` guard. - `EhcacheProducer.java:50`: the producer takes its `Cache` in `doStart`, after its reference, which reopens a closed manager. New test `producerTakesTheCacheAgainWhenItsManagerWasClosedAndOpenedAgain` uses one producer instance: the count drops to 0, the endpoint and the producer start again, and put/get work. With the cache taken in the constructor it fails with `IllegalStateException: State is UNINITIALIZED`. - Nit: `EhcacheRemoveRouteTest` uses `MockEndpoint.assertIsSatisfied(context)`. camel-ehcache: 80 tests, 0 failures; `EhcacheRemoveRouteTest` passed 20 runs in one JVM. No open follow-ups. _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]
