-
Notifications
You must be signed in to change notification settings - Fork 589
Closed
Description
hello,
In code org.ehcache.internal.store.disk.OffHeapDiskStore#recoverBackingMap, there are the following logs
The index for data file {} is out of date by {}ms, probably due to an unclean shutdown. Creating a new empty store
that may cause all the data been ignored thus lossing all the data that persist before.
So In a Java web application, How to properlly shutdown EHCache to verify that all data in cache flushed into disk before application exited.
here is my code & xml
final URL myUrl = HelloServlet.class.getResource("/ehcache.xml");
Configuration xmlConfig = null;
try {
xmlConfig = new XmlConfiguration(myUrl);
} catch (Exception e) {
e.printStackTrace();
}
cacheManager = CacheManagerBuilder.newCacheManager(xmlConfig);
System.out.println("hitting...");
if (cacheManager.getStatus() != Status.AVAILABLE) {
System.out.println("cacheManager = " + cacheManager.getStatus());
cacheManager.init();
}
cache = cacheManager.getCache("test", String.class, String.class);
xml
<core:config xmlns:core="http://www.ehcache.org/v3">
<core:service>
<core:persistence directory="/Users/yuankui/tmp/mydata" />
</core:service>
<core:cache alias="test">
<core:key-type copier="org.ehcache.internal.copy.SerializingCopier">java.lang.String</core:key-type>
<core:value-type copier="org.ehcache.internal.copy.SerializingCopier">java.lang.String</core:value-type>
<core:expiry>
<core:tti unit="minutes">2</core:tti>
</core:expiry>
<core:eviction-prioritizer>LFU</core:eviction-prioritizer>
<core:resources>
<core:heap size="200" unit="entries" />
<core:offheap size="200" unit="mb" />
<core:disk size="2000" persistent="true" unit="mb" />
</core:resources>
</core:cache>
</core:config>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels