# HG changeset patch # User Ingo Weinzierl # Date 1275640618 0 # Node ID f3fdbeef1c6829f936fd9aa3de8e0f3ef6af285b # Parent f76541120bcb3517e854389f9b8c9608db078eee Made sql-cache statistics available as MBean in JConsole. geo-backend/trunk@1156 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r f76541120bcb -r f3fdbeef1c68 geo-backend/ChangeLog --- a/geo-backend/ChangeLog Fri Jun 04 08:19:38 2010 +0000 +++ b/geo-backend/ChangeLog Fri Jun 04 08:36:58 2010 +0000 @@ -1,3 +1,10 @@ +2010-06-04 Ingo Weinzierl + + * src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java: + The ehcache CacheManager and the MBeanServer of the JVM are connected + so that the statistics of the sql-cache is available as MBean using + JConsole. + 2010-06-04 Ingo Weinzierl * src/main/java/de/intevation/gnv/geobackend/sde/datasources/Uncacheable.java: diff -r f76541120bcb -r f3fdbeef1c68 geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java --- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java Fri Jun 04 08:19:38 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java Fri Jun 04 08:36:58 2010 +0000 @@ -1,17 +1,25 @@ package de.intevation.gnv.geobackend.base.query; +import de.intevation.gnv.geobackend.base.Result; + +import de.intevation.gnv.geobackend.base.query.cache.CacheCleaner; + +import de.intevation.gnv.geobackend.config.Configuration; + +import java.lang.management.ManagementFactory; + import java.util.Collection; import java.util.Iterator; +import javax.management.MBeanServer; + import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; import net.sf.ehcache.Element; -import org.apache.log4j.Logger; +import net.sf.ehcache.management.ManagementService; -import de.intevation.gnv.geobackend.base.Result; -import de.intevation.gnv.geobackend.base.query.cache.CacheCleaner; -import de.intevation.gnv.geobackend.config.Configuration; +import org.apache.log4j.Logger; /** * @author Sascha L. Teichmann @@ -45,6 +53,8 @@ ? new CacheManager(configFile) : new CacheManager(); manager.addCache(CACHE_NAME); + MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); + ManagementService.registerMBeans(manager, mBeanServer, false, false, false, true); CacheCleaner cc = new CacheCleaner(); cc.start(); }