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

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -