The cleanest way would be to programmatically perform a call to JMX server to obtain this
info. Another way is to work with the CacheMgmtInterceptor directly. This is the
interceptors that supplies those statistics, you can access it through
((CacheSPI)cache).getInterceptorChain() - returns a List of Interceptor objects.
Some notes on the method itself: on each call to the method, the cache will be iterated in
order to count the nodes, which might be expensive. Also, no lock is acquired, so if an
node is evicted or removed *during* iteration then this might not be reflected in the
final result. If you want to avoid this, you can write your own counting mechanism (might
not be such a bad idea, as it would keep your hands clean from working with cache
internals/SPI).
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4129048#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...