We've got a spring batch deployment (using Batch Admin) and we've run into an issue where our application's ehcache.xml config is not being respected when the AnnotationSessionFactoryBean bootstraps Hibernate. We traced it to the fact that SimpleEhCacheInterceptor invokes CacheManager.create(config ) to create an unnamed manager and uses the failsafe configuration. As a result all of our cached entities are now overflowing to disk, which is something we don't want.
We were able to fix this by amending our ehcache.xml file to include a cache manager name in the top element:Code:public void afterPropertiesSet() throws Exception { Configuration config = ConfigurationFactory.parseConfiguration(); config.setUpdateCheck(false); manager = CacheManager.create(config ); cache = new Cache(name, 0, true, false, timeout, 0); manager.addCache(cache); }
It seems like it would be somewhat better if the CacheManager SimpleEhCacheInterceptor would name itself so that it didn't supersede whatever default cache manager was used by the spring context that actually contained the job implementations.Code:<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true" name="myCacheManager">
Has anyone else run into this or does everyone just work with names configured into their ehcache.xml configs?


Reply With Quote
