You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Krzysztof Hołdanowicz (JIRA)" <ji...@apache.org> on 2017/11/24 17:19:00 UTC

[jira] [Created] (CAMEL-12037) File idempotent repository is always initialized with default 1000 cache size

Krzysztof Hołdanowicz created CAMEL-12037:
---------------------------------------------

             Summary: 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


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)