java - Caches of all versions of a webapp deployed in parallel are shutdowned -
i use ehcache in webapp versions deployed in parallel on tomcat instance. handy way deploy new versions without stopping application.
i have problem way proceed : if give cache , disk store different names, depending on versions of webapp, all caches stopped when stopping one instance.
my config :
<?xml version="1.0" encoding="utf-8"?> <ehcache xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="ehcache.xsd" name="mywebapp-${project.version}_build_${buildnumber}"> <defaultcache maxelementsinmemory="1000" maxelementsondisk="10000" eternal="false" timetoliveseconds="300" timetoidleseconds="300" overflowtodisk="true" diskpersistent="false" memorystoreevictionpolicy="lru" statistics="true" /> <cache maxelementsinmemory="1000" maxelementsondisk="10000" name="org.hibernate.cache.internal.standardquerycache" eternal="false" timetoliveseconds="300" timetoidleseconds="300" overflowtodisk="true" diskpersistent="false" statistics="true"/> <cache name="org.hibernate.cache.spi.updatetimestampscache" maxelementsinmemory="10000" maxelementsondisk="100000" timetoliveseconds="300" timetoidleseconds="300" eternal="false" overflowtodisk="true" diskpersistent="false" statistics="true"/> <cache name="query.presences" maxelementsinmemory="100" maxelementsondisk="1000" eternal="false" timetoliveseconds="300" timetoidleseconds="300" overflowtodisk="true" diskpersistent="false" statistics="true"/> <diskstore path="java.io.tmpdir/mywebapp-${project.version}_build_${buildnumber}"/> </ehcache>
${project.version}
, ${buildnumber}
being replaced maven during build process.
does know how avoid unwanted behaviour ?
i using ehcache-core-2.4.3 , hibernate-ehcache-4.3.8.
the way net.sf.ehcache.constructs.web.shutdownlistener
works shutting down all cache managers.
so way work making sure cache managers end in different class loaders, ehcache loaded web application class loader , not container one.
do provide ehcache jar in app's web-inf/lib
? if yes, sure there not ehcache in tomcat's classpath?
if solution still not work, may better off creating own servletcontextlistener
shutdown cache manager containing application.
Comments
Post a Comment