Ehcache disk store unclean shutdown

后端 未结 3 2007
轮回少年
轮回少年 2020-12-14 13:20

I\'m using a cache with disk store persistence. On subsequent reruns of the app I\'m getting the following error:

net.sf.ehcache.store.DiskStore deleteIndexI         


        
3条回答
  •  一向
    一向 (楼主)
    2020-12-14 14:02

    For those of us using Ehcache with Spring 3.1+ and java config, you have to use:

    @Bean(destroyMethod = "shutdown")
    public net.sf.ehcache.CacheManager ehCacheManager() { .. }
    

    and (assuming you're also using a non-web Spring ApplicationContext, enable the shutdown hook there to cause the bean to be destroyed gracefully:

    context = new AnnotationConfigApplicationContext(AppConfig.class);
    ((AbstractApplicationContext) context).registerShutdownHook();
    

    see this for more information.

提交回复
热议问题