# HG changeset patch # User Ingo Weinzierl # Date 1275641272 0 # Node ID cf421645a2d3186223f829cd043b4a72632b156f # Parent 026b936290bcf41bc880e1024cfdcf6692fcb1d7 Made cache statistics available as MBeans (eg in JConsole). gnv-artifacts/trunk@1157 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 026b936290bc -r cf421645a2d3 gnv-artifacts/ChangeLog --- a/gnv-artifacts/ChangeLog Thu Jun 03 16:12:35 2010 +0000 +++ b/gnv-artifacts/ChangeLog Fri Jun 04 08:47:52 2010 +0000 @@ -1,3 +1,9 @@ +2010-06-04 Ingo Weinzierl + + * src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java: The + ehcache CacheManager and the MBeanServer of the JVM are connected so that + the statistics of the cache is available as MBean in JConsole. + 2010-06-03 Ingo Weinzierl * src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java: diff -r 026b936290bc -r cf421645a2d3 gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java Thu Jun 03 16:12:35 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java Fri Jun 04 08:47:52 2010 +0000 @@ -1,8 +1,14 @@ package de.intevation.gnv.artifacts.cache; +import java.lang.management.ManagementFactory; + +import javax.management.MBeanServer; + import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; +import net.sf.ehcache.management.ManagementService; + import org.apache.log4j.Logger; import de.intevation.gnv.geobackend.base.query.cache.CacheCleaner; @@ -75,6 +81,11 @@ if (cacheManager == null) { cacheManager = new CacheManager(configurationFileName); cacheManager.addCache(CACHENAME); + + MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer(); + ManagementService.registerMBeans( + cacheManager, beanServer, false, false, false, true); + this.cacheCleaner = new ThematicDataCacheCleaner(); this.cacheCleaner.start(); }