We are currently integrate jboss-cache in our project and it works really good. But the only thing not working is the statistic-mbeans (neither in jmx-console nor in jconsole). The only attribute which refreshes is the time elapsed since starting/reset.

This is our environment:

- Linux- JBossCache-1.4.0.SP1- Sun JDK 1.5- jboss-4.0.4.GA-ejb3

And this is out configuration (this is very similar to 'local-service.xml'):

If you see the CacheMgmtInterceptor mbean in your JBoss JMX Console display, then UseInterceptorMbeans is definitely enabled.

The main TreeCache mbean (e.g., service=TreeCacheXX) and the CacheMgmtInterceptor mbean both have attributes named "Number of Nodes" and "Number of Attributes." Are these entries non-zero and correct in both mbeans? The CacheMgmtInterceptor mbean obtains this information directly from the TreeCache mbean so the values should be identical.

I added the JBossCache 1.4SP1 jar to my JBossAS 4.0.4GA server and found that the tomcat cache instance did successfully display statistics. I just used the cache's mbean to add and retrieve some nodes; the statistics mbean displayed the expected results.

I suppose it's possible that PojoCache isn't using TreeCache under some circumstances. I haven't looked at the PojoCache code to see if this is the case.

I did try a quick test using the TomcatClusteringCache service and I didn't note any problems there. It uses TreeCacheAop rather than PojoCache though. TreeCacheAop is a legacy wrapper around PojoCache so it should exhibit the same behavior.

I started the "all" server and then accessed the mbean for service=TomcatClusteringCache. The underlying implelementation here is org.jboss.cache.aop.TreeCacheAop so that should be similar to what you're using. I issued some put (String, Object, Object) and get(String, Object) operations using the mbean. I then accessed the service=TomcatClusteringCache,treecache-interceptor=CacheMgmtInterceptormbean and found the statistics were correct. Hits, misses stores and the hit/miss ratio correctly reflected the put and get operations that I executed.

I took a quick look at the PojoCache implementation and it looks like you may be correct that the CacheMgmtInterceptor isn't invoked when an aop method such as getObject() or putObject() is invoked. Statistics would be accumulated when a TreeCache method such as put() or get() is invoked.

The unit tests for statistics are located in org.jboss.cache.mgmt. The MgmtCoreTest class is the one that tests puts, gets, evictions, etc.

I've only executed tests against TreeCache, not PojoCache (or TreeCacheAop). AFAIK, there was no discussion of PojoCache when we implemented cache statistics.

I think that statistics will work for PojoCache when you use the put() and get() methods. These should be handled by the underlying TreeCache and the associated statistics will be correct. I've validated this to some degree by using the TomcatClusteringCache mbean to put and get cache entries. The statistics are correct after these operations.

However this issue states that statistics don't work when PojoCache uses the putObject() method. I haven't tested it personally but I have looked at the code and it doesn't look like this method is delegated to TreeCache or one of its interceptors.

Unless I'm mistaken, this is an area that we never discussed. Maybe PojoCache should provide its own interceptor containing statistics that are unique to it?