[ 
https://issues.apache.org/jira/browse/CAMEL-11266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16009362#comment-16009362
 ] 

Marco Santarelli commented on CAMEL-11266:
------------------------------------------

[~cib...@e-ma.net] as described here 
(http://www.ehcache.org/documentation/3.3/tiering.html#disk, 2nd information 
bullet) a disk-tier enabled CacheManager cannot share the same configuration, a 
persistence directory must be dedicated to a single cache manager. Perhaps it 
is my lack of understanding of how to use this new component, but having a 
separate CacheManager and configuration per route seems like a bad design 
choice, this was not the case with camel-cache (also based on ehcache). I will 
provide a reduced sample test project that exemplifies the problematic.

> The component creates a separate CacheManager per producer route
> ----------------------------------------------------------------
>
>                 Key: CAMEL-11266
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11266
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ehcache
>    Affects Versions: 2.19.0
>            Reporter: Marco Santarelli
>
> The issue becomes clear if the developers declares more than one producer 
> route with the attached ehcache config: multiple cache managers start 
> contention of file lock and the startup fails.
> {code:xml}
>  <?xml version="1.0" encoding="UTF-8"?>
> <ehcache:config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>                 xmlns:ehcache="http://www.ehcache.org/v3";
>                 xsi:schemaLocation="http://www.ehcache.org/v3 
> http://www.ehcache.org/schema/ehcache-core-3.3.xsd";>
>     <ehcache:persistence 
> directory="${java.io.tmpdir}/ehcache"></ehcache:persistence>
>     <ehcache:cache alias="cache1" uses-template="default-template">
>     </ehcache:cache>
>     <ehcache:cache alias="cache2" uses-template="default-template">
>         <ehcache:expiry>
>             <ehcache:ttl unit="minutes">60</ehcache:ttl>
>         </ehcache:expiry>
>     </ehcache:cache>
>     <ehcache:cache alias="cache3" uses-template="default-template">
>         <ehcache:expiry>
>             <ehcache:ttl unit="minutes">1</ehcache:ttl>
>         </ehcache:expiry>
>     </ehcache:cache>
>     <ehcache:cache-template name="default-template">
>         <ehcache:key-type>java.lang.String</ehcache:key-type>
>         <ehcache:value-type>java.io.Serializable</ehcache:value-type>
>         <ehcache:expiry>
>             <ehcache:none/>
>         </ehcache:expiry>
>         <ehcache:resources>
>             <ehcache:heap unit="entries">1000</ehcache:heap>
>             <ehcache:disk persistent="true" unit="MB">10</ehcache:disk>
>         </ehcache:resources>
>     </ehcache:cache-template>
> </ehcache:config>
> {code}
> resulting in:
> {code}
> Caused by: org.ehcache.StateTransitionException: Couldn't lock rootDir: 
> /var/folders/gf/6psxkr_n7vl_qbhw8mktqqww0000gn/T/ehcache
>       at 
> org.ehcache.core.StatusTransitioner$Transition.failed(StatusTransitioner.java:235)
>  ~[ehcache-3.2.2.jar:3.2.2 892e5c56c2a7100866de90dc7c2099a62fb6198b]
>       at org.ehcache.core.EhcacheManager.init(EhcacheManager.java:588) 
> ~[ehcache-3.2.2.jar:3.2.2 892e5c56c2a7100866de90dc7c2099a62fb6198b]
>       at 
> org.apache.camel.component.ehcache.EhcacheManager.start(EhcacheManager.java:66)
>  ~[camel-ehcache-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.component.ehcache.EhcacheEndpoint.doStart(EhcacheEndpoint.java:65)
>  ~[camel-ehcache-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:236) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1447)
>  ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:44)
>  ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:31)
>  ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.processor.interceptor.DefaultChannel.doStart(DefaultChannel.java:156)
>  ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:80)
>  ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at 
> org.apache.camel.impl.RouteService.startChildService(RouteService.java:364) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:196) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       at org.apache.camel.impl.RouteService.warmUp(RouteService.java:145) 
> ~[camel-core-2.19.0.jar:2.19.0]
>       ... 28 common frames omitted
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to