[
https://issues.apache.org/jira/browse/CAMEL-12037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16265751#comment-16265751
]
ASF GitHub Bot commented on CAMEL-12037:
----------------------------------------
GitHub user zurkin opened a pull request:
https://github.com/apache/camel/pull/2118
CAMEL-12037 Idempotent repository cache initialization fix.
Also consider moving this initalization block to a default constructor.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/zurkin/camel master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/camel/pull/2118.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2118
----
commit 9c002bf387d9687234aa41abe084763a4cbdf388
Author: Krzysztof Holdanowicz <[email protected]>
Date: 2017-11-25T15:42:04Z
CAMEL-12037 Idempotent repository cache initialization fix.
----
> File idempotent repository is always initialized with default 1000 cache size
> -----------------------------------------------------------------------------
>
> Key: CAMEL-12037
> URL: https://issues.apache.org/jira/browse/CAMEL-12037
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.20.0
> Reporter: Krzysztof Hołdanowicz
> Fix For: 2.20.2, 2.21.0
>
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> http://camel.465427.n5.nabble.com/File-idempotent-repository-problem-since-2-20-td5815760.html
> So far we've been using file idempotent repository which was defined like
> this:
> <bean id="download repository"
> class="of.apache.camel.processor.idempotent.FileIdempotentRepository">
> <property name="fileStore" value="work/.downloadStore.dat" />
> <property name="cacheSize" value="5000" />
> </bean>
> However since Camel version 2.20 I can see that in
> FileIdempotentRepository.java there is a cache initialization in method
> doStart():
> protected void doStart() throws Exception {
> ...
> this.cache = LRUCacheFactory.newLRUCache(1000);
> ...
> }
> which always overrides our cacheSize definition with default value, because
> doStart method is always invoked just after bean initialization (if the
> init-method="start" was specified in bean definition) or during camel
> context initialization.
> As a consequence our idempotent stores always have a default 1000 cache
> size limit.
> Shuldn't the doStart method check the cache instance first before
> initializing it with default cache size e.g.
> protected void doStart() throws Exception {
> ...
> if (this.cache == null) {
> this.cache = LRUCacheFactory.newLRUCache(1000);
> }
> ...
> }
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)