I am using ehcache (3.8.0) with Java (1.8.0_222) to store values on the heap that are retrieved from a SQL database. The issue I'm having is that the stored values are lists of objects, and those objects also contain lists and over time references in those innermost lists seem to be becoming null. I've tried recreating it in a smaller program without success so I'm guessing it's something daft I've overlooked rather than a problem with ehcache.
The code I'm using for setting up the cache is
final long cacheSize = 1L; final MemoryUnit cacheUnits = MemoryUnit.GB; ResourcePoolsBuilder resourcePools = ResourcePoolsBuilder .newResourcePoolsBuilder() .heap(cacheSize, cacheUnits); CacheConfigurationBuilder<Key, List<MyInterface>> cacheConfigurationBuilder = CacheConfigurationBuilder .newCacheConfigurationBuilder(Key.class, (Class<List<MyInterface>>)(Class<?>)List.class, resourcePools) .withSizeOfMaxObjectGraph(Long.MAX_VALUE); cacheManager = CacheManagerBuilder .newCacheManagerBuilder() .withCache(cachesName, cacheConfigurationBuilder) .build(); cacheManager.init(); cache = cacheManager.createCache(cacheName, cacheConfigurationBuilder);