Note that there are some explanatory texts on larger screens.

plurals
  1. POEhcache disk store unclean shutdown
    primarykey
    data
    text
    <p>I'm using a cache with disk store persistence. On subsequent reruns of the app I'm getting the following error:</p> <pre><code>net.sf.ehcache.store.DiskStore deleteIndexIfCorrupt WARNING: The index for data file MyCache.data is out of date, probably due to an unclean shutdown. Deleting index file MYCache.index </code></pre> <p>Is there any way to fix that apart from explicitly calling <code>net.sf.ehcache.CacheManager.shutdown()</code> somewhere in the app?</p> <p>Cache configuration:</p> <pre><code>&lt;ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true" monitoring="autodetect"&gt; &lt;diskStore path="C:\work"/&gt; &lt;cacheManagerEventListenerFactory class="" properties=""/&gt; &lt;cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1, multicastGroupPort=4446, timeToLive=1" propertySeparator="," /&gt; &lt;cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/&gt; &lt;defaultCache maxElementsInMemory="1" eternal="false" timeToIdleSeconds="0" timeToLiveSeconds="86400" overflowToDisk="true" diskSpoolBufferSizeMB="1" maxElementsOnDisk="10000" diskPersistent="true" diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LFU" /&gt; &lt;/ehcache&gt; </code></pre> <p>Code to replicate the issue:</p> <pre><code>import java.util.ArrayList; import java.util.List; import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; import net.sf.ehcache.Element; public class CacheTest { static CacheManager manager = new CacheManager(CacheTest.class .getResource("ehcache.xml")); static Cache cache; public static void main(String[] args) { // Get a default instance manager.addCache("test"); cache = manager.getCache("test"); // Generate some junk so that the // cache properly flushes to disk // as cache.flush() is not working List&lt;String&gt; t = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; 1000; i++) t.add(null); // Oddly enough fewer elements // do not persist to disk or give // an error for (int i = 0; i &lt; 100000; i++) { cache.put(new Element(i, t)); } cache.flush(); if (cache.get("key1") == null) { System.out.println("key1 not found in cache!"); cache.put(new Element("key1", "value1")); } System.out.println(cache.get("key1")); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload