camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luca Burgazzoli (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-11266) The ehcache component creates a separate CacheManager per producer route
Date Tue, 16 May 2017 15:12:04 GMT

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

Luca Burgazzoli commented on CAMEL-11266:
-----------------------------------------

I digged a little into the code and if we configure the cache manager on component level we'll
lose the option to have different endpoint targeting different ehcache instances so the way
to go in camel 2.19.x is to tell the endpoints to use a pre-configured cache manager using
the cacheManager (I've updated the doc so it should appears soon on the website).

Example:

{code:java}
    from("direct:cache")
        .to("ehcache:my-cache?cacheManager=#myCacheManager&keyType=java.lang.String&valueType=java.lang.String");
{code}

>From camel 2.20 the camel component will expose some methods to set defaults like:

{code:java}
    EhcacheComponent ehcache = new EhcacheComponent();
    ehcache.getConfiguration().setCacheManager(myCacheManager);
{code}

So if you put an object like that in the camel context/registry, you'll be able to write your
route as:

{code:java}
    from("direct:cache")
        .to("ehcache:my-cache?keyType=java.lang.String&valueType=java.lang.String");
{code}

> The ehcache 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
>            Assignee: Luca Burgazzoli
>             Fix For: 2.20.0
>
>
> 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)

Mime
View raw message