[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Avoid PermGen Space because of re-deploy webapp multiple time.  XML
Forum Index -> Ehcache
Author Message
carotsay

neo

Joined: 08/14/2014 07:58:59
Messages: 1
Offline

Hi guys,
I'd like to ask for your experience about working with ehcache and spring integration.
webapp-config.xml
<!-- ******************************* ***** CACHE CONFIGURATION ***** ******************************* -->
<!-- Cache Annotation -->
<cache:annotation-driven />
<bean
id="cacheManager"
class="org.springframework.cache.ehcache.EhCacheCacheManager"
p:cacheManager-ref="ehcache" />
<bean
id="ehcache"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
p:configLocation="classpath:ehcache.xml"
p:shared="true" /> 

ehcache.xml
<?xml version="1.0" encoding="UTF-8"?>

<ehcache
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
maxBytesLocalHeap="100M"
maxBytesLocalDisk="1G">
<diskStore path="java.io.tmpdir" />
<sizeOfPolicy maxDepth="1000" maxDepthExceededBehavior="abort"/>
<cache
name="listEmployee"
maxBytesLocalHeap="100%"
maxBytesLocalDisk="100%"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
diskExpiryThreadIntervalSeconds="120"
transactionalMode="off"
memoryStoreEvictionPolicy="LFU">
<persistence strategy="localTempSwap"/>
</cache>
</ehcache> 

I also add a shutdown event when the server is restart.
<listener>
<listener-class>net.sf.ehcache.constructs.web.ShutdownListener</listener-class>
</listener> 

Whatever, whenever the server is re-deploy the webapp, the size of Memory is increased. Consequently, it will be out of memory (permgen space) when re-deploying multiple time.
The question is: HOW CAN WE CLEAR, SHUTDOWN, RE-INIT THE CACHE MANAGER WHICH CAN AVOID INCREASE THE MEMORY AFTER THE WEBAPP IS REDEPLOYED ?

P/S: I've tried to shutdown the CacheManager before redeploy but it's not work !
I use tomcat server 7.0, ehcache and webapp run on it.
 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team