shashank created CAMEL-27215:
--------------------------------

             Summary: camel-jcache - an idempotent, aggregation or key-value 
repository that opens its cache from its configuration uses the closed cache 
after it is started again (route reload)
                 Key: CAMEL-27215
                 URL: https://issues.apache.org/jira/browse/CAMEL-27215
             Project: Camel
          Issue Type: Bug
          Components: camel-jcache
            Reporter: shashank
            Assignee: shashank


h3. What happens

{{JCacheIdempotentRepository}}, {{JCacheAggregationRepository}} and 
{{JCacheKeyValueRepository}} open their cache on start when they are given a 
configuration ({{cacheName}}), and close their cache manager on stop, which 
releases the cache (and closes it, the cache manager and the caching provider 
when nothing else uses them, CAMEL-26287). The cache field is kept, so the next 
start wraps the closed cache instead of opening it again: every {{add}} / 
{{get}} / {{put}} then fails with {{IllegalStateException}} (cache closed).

The repository is stopped and started again when its route is removed and added 
again, as a route reload does (the idempotent consumer and the aggregator stop 
their repository when the route is removed), or when the CamelContext is 
stopped and started. After that every exchange of the route fails.

h3. How to reproduce

{{JCacheRepositoriesRestartTest}} (camel-jcache): an idempotent consumer with a 
repository from {{cacheName}}, the route removed and added again: the next 
exchange fails; each repository started, stopped and started again fails on its 
first operation.

h3. Fix

On stop, a repository that opened its cache from its configuration forgets it 
after closing its manager, so the next start opens it again. A cache given with 
{{setCache}} is kept, as before (the repository never closes it).

_Filed with Claude Code on behalf of allthingssecurity._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to