I am studying Oracle Coherence for a client, and one of the things they are interested in is to get statistical information from her in order to understand usage patterns, etc.
I know that I can get some information from JMX, however there is also a CacheStatistics interface with which I want to receive data. However, I can’t understand how I can go from the cache object to its statistics.
Below is my implementation of poc, and I can use the "cache" object to place and retrieve values from the cache, is there any way to associate the cache with the relevant statistics? I guess I missed something somewhere ...
NamedCache cache = CacheFactory.getCache(cacheName);
if(cache.isActive()){
//Wrong because there no link to the cache..
SimpleCacheStatistics scs = new SimpleCacheStatistics();
long hits = scs.getCacheHits();
System.out.println("Cache hits:" +hits+"\n : "+scs.toString());
}
source
share