[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Messages posted by: rhn4i  XML
Profile for rhn4i -> Messages posted by rhn4i [3]
Author Message
Hi

Reading other posts, I see that I can define my own custom eviction policy, which is great.

My question is - Is there a way to specify this custom policy (per cache) in ehcache.xml config file (we use spring to initialize all our caches).

Thank you,
By 'terminate' I mean, in Eclipse IDE menu 'Run' -> 'Terminate' operation. I am not 100% whether it terminates or aborts the JVM, but it appears that shutdown hook is not sufficient in this case.

According to your post, the only way to ensure correct disk-persistence between VM restarts is to shut cache manager down cleanly.

Is there anything that app code could do to periodically "snapshot" .index files, instead of waiting until graceful cache manager shutdown?
I would like to use disk persistence using Ehcache (2.5.1). I have done the following so far -

1. set diskPersistent=true on each cache I want to persist
2. enabled shutdown hook

Using eclipse, I am able to test that when I exit the process gracefully, persistence mechanism creates .index (and .data) files correctly. The next restart of the VM then loads the cache (I have configured net.sf.ehcache.store.DiskStoreBootstrapCacheLoaderFactory).

1. However, when I terminate the process, the .index files are not generatd and next restart of the VM doesn't load cache as expected. I would have thought enabling shutdown hook would take care in this situation?

2. Since #1 didn't work, I scheduled a task that flushes all caches to disk every 1 min. With this, I am able to see all .index files. Even then, when the process is terminated, the index files are corrupted and the next restart of VM throws this error -

Warning net/sf/ehcache/store/disk/DiskStorageFactory The index for data file C:\temp\ehcache\ValueClass.data is out of date, probably due to an unclean shutdown. Deleting index file C:\temp\ehcache\ValueClass.index (noclass.)


Is there anything that I could do to *guarantee* that files are always persisted correctly and cache loaded on next VM restart?
 
Profile for rhn4i -> Messages posted by rhn4i [3]
Go to:   
Powered by JForum 2.1.7 © JForum Team