java - How to shutdown Ehcache CacheManager in standalone application -
i have simple api clients use in standalone application. behind scenes api uses ehcache performance.
everything works fine except client needs invoke shutdown()
method in api invoke cachemanager.shutdown()
without ehcache continues run in background though main thread completed.
is there way can avoid shutdown()
call client?
i tried using @predestroy spring annotation invoke call, didn't work?
here adding sample client program.
public class clientapp{ @autowired private iclientservice service; public static void main(string[] args){ try{ service.getclients(); ... } { service.shutdown(); // shutdown cache background thread } } }
in clientserviceimpl.java, have following lines
public void shutdown(){ logger.info("shutting cache down..."); ehcachemanager.shutdown(); }
your example confirms standalone application setup. ehcache should not prevent jvm shutting down when main thread terminates.
if does, need add thread dumps issue can analyse further issue , cause.
Comments
Post a Comment