EHC ❯ Ehcache doesnt persist changes to disk on shutdown
-
Bug
-
Status: Closed
-
-
Resolution: Fixed
-
-
-
drb
-
Reporter: sourceforgetracker
-
September 21, 2009
-
0
-
Watchers: 0
-
September 22, 2009
-
September 22, 2009
Description
When using ehcache as hibernate 2nd level cache with RMI replication persisting cache to disk on application server shutdown doesnt work. Ehcache creates 0 sized files upon startup and does not write to them anything upon JBoss shutdown. Manually flushing cache contents to disk works as expected.
My ehcache.xml:
<?xml version=”1.0” encoding=”UTF-8”?>
Sourceforge Ticket ID: 2445309 - Opened By: nobody - 18 Dec 2008 13:56 UTC
Comments
Sourceforge Tracker 2009-09-21
Fiona OShea 2009-09-22
Re-opening so that I can properly close out these issues and have correct Resolution status in Jira
Ehcache used to come with a shutdown hook for cleanly shutting the cache down but it was troublesome when servers and other frameworks had shutdown hooks.
In you use case, try wiring this up to JBoss:
public class ShutdownListener implements ServletContextListener {
by adding the following to web.xml:
Alternatively enable the shutdown hook in ehcache by adding a system property “net.sf.ehcache.enableShutdownHook=true” to your JBoss startup. Comment by: gregluck - 4 Apr 2009 07:42 UTC