Alexandre Gattiker created CAMEL-6101:
-----------------------------------------

             Summary: Cache endpoint lazy initialization is not thread safe
                 Key: CAMEL-6101
                 URL: https://issues.apache.org/jira/browse/CAMEL-6101
             Project: Camel
          Issue Type: Bug
          Components: camel-cache
    Affects Versions: 2.10.3
            Reporter: Alexandre Gattiker


Similar to CAMEL-5950, but only occurs at lazy cache initialization.

{code}
net.sf.ehcache.ObjectExistsException: Cache sampleCache already exists
    at net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:1294) 
~[org.apache.servicemix.bundles.ehcache-2.5.2_1.jar:na]
    at net.sf.ehcache.CacheManager.addCache(CacheManager.java:1184) 
~[org.apache.servicemix.bundles.ehcache-2.5.2_1.jar:na]
    at 
org.apache.camel.component.cache.CacheEndpoint.initializeCache(CacheEndpoint.java:137)
 ~[camel-cache-2.10.3.jar:2.10.3]
{code}

Workaround:

{code}
                for (Endpoint endpoint : context.getEndpoints()) {
                        if (endpoint instanceof CacheEndpoint) {
                                CacheEndpoint ce = (CacheEndpoint) endpoint;
                                ce.initializeCache();
                        }
                }
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to