comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/cache/CacheFactory.java @ 382:e07d1c3f7667

Flush/persist cache at end of program. flys-artifacts/trunk@1798 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 02 May 2011 16:50:58 +0000
parents 7f7d6037d242
children 0c8aca463bd4
comparison
equal deleted inserted replaced
381:52b6de9d0ab4 382:e07d1c3f7667
36 cacheManager = CacheManager.create(configFile); 36 cacheManager = CacheManager.create(configFile);
37 //System.setProperty( 37 //System.setProperty(
38 // "net.sf.ehcache.enableShutdownHook", "true"); 38 // "net.sf.ehcache.enableShutdownHook", "true");
39 Runtime.getRuntime().addShutdownHook(new Thread() { 39 Runtime.getRuntime().addShutdownHook(new Thread() {
40 public void run() { 40 public void run() {
41 log.info("shutting down caches");
42 for (String name: cacheManager.getCacheNames()) {
43 log.info("\tflushing '" + name + "'");
44 cacheManager.getCache(name).flush();
45 }
41 cacheManager.shutdown(); 46 cacheManager.shutdown();
42 } 47 }
43 }); 48 });
44 } 49 }
45 catch (CacheException ce) { 50 catch (CacheException ce) {

http://dive4elements.wald.intevation.org