java - Camel and Cache LifeCycle -


i have troubles management of ehcache lifecycle within camel. have routes defined in spring dsl. can load them dynamically through application. in initial load of camel context, cache works marvelously. yet, if stop camel context , try restart it, ehcache doesn't restart. have no ehcache custom configuration. means whole lifecycle managed camel-cache.

here exception when try access ehcache after restarting camel context:

java.lang.illegalstateexception: demo cache not alive (status_shutdown)         @ net.sf.ehcache.cache$cachestatus.checkalive(cache.java:4009) ~[ehcache2.8.0.jar:2.8.0] @ net.sf.ehcache.cache.checkstatus(cache.java:2717) ~[ehcache-2.8.0.jar:2.8.0] 

is there way have better control on ehcache lifecycle management can restart cache when route restarted?

along lines, there way setup cache such globally visible in jvm opposed being tied 1 camel context? in other words, there ay setup ehcache such can restart camel contexts without shuting down ehcache?

consider using spring's support ehcache shall remove dependency of managing ehcache camel. mean use spring manage ehcache rather camel starting/stopping of camelcontext/routes won't affect ehcache. check jmx support provided ehcache have other requirement global visibility. enabling jmx support need use ehcache management service below :

<bean id="ehcachemanagementservice" class="net.sf.ehcache.management.managementservice" init-method="init" lazy-init="false">   <constructor-arg>     <bean class="net.sf.ehcache.cachemanager" factory-method="getinstance"/>   </constructor-arg>   <constructor-arg>     <bean class="org.springframework.jmx.support.jmxutils" factory-method="locatembeanserver"/>   </constructor-arg>   <constructor-arg value="true"/>   <constructor-arg value="true"/>   <constructor-arg value="true"/>   <constructor-arg value="true"/> </bean> 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -