changeset 1124:f3fdbeef1c68

Made sql-cache statistics available as MBean in JConsole. geo-backend/trunk@1156 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 04 Jun 2010 08:36:58 +0000
parents f76541120bcb
children 959618206b8a
files geo-backend/ChangeLog geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java
diffstat 2 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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 <ingo.weinzierl@intevation.de>
+
+	* 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 <ingo.weinzierl@intevation.de>
 
 	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/Uncacheable.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 <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
@@ -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();
         }

http://dive4elements.wald.intevation.org