Package org.apache.jackrabbit.oak.cache
Class CacheStatsMBeanWrapper
- java.lang.Object
-
- org.apache.jackrabbit.oak.cache.CacheStatsMBeanWrapper
-
- All Implemented Interfaces:
CacheStatsMBean
public class CacheStatsMBeanWrapper extends java.lang.Object implements CacheStatsMBean
-
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean
TYPE
-
-
Constructor Summary
Constructors Constructor Description CacheStatsMBeanWrapper(CacheStatsMBean delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcacheInfoAsString()Gathers the stats of the cache for logging.longestimateCurrentWeight()Total weight of the complete cache.doublegetAverageLoadPenalty()Returns the average time spent loading new values.longgetElementCount()Get the number of elements/objects in the cache.longgetEvictionCount()Returns the number of times an entry has been evicted.longgetHitCount()Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cachelookup methods have returned a cached value.doublegetHitRate()Returns the ratio of cache requests which were hits.longgetLoadCount()Returns the total number of times thatorg.apache.jackrabbit.guava.common.cache.Cachelookup methods attempted to load new values.longgetLoadExceptionCount()Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cachelookup methods threw an exception while loading a new value.doublegetLoadExceptionRate()Returns the ratio of cache loading attempts which threw exceptions.longgetLoadSuccessCount()Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cachelookup methods have successfully loaded a new value.longgetMaxTotalWeight()The maximum weight of entries the cache may contain.longgetMissCount()Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cachelookup methods have returned an uncached (newly loaded) value, or null.doublegetMissRate()Returns the ratio of cache requests which were misses.java.lang.StringgetName()longgetRequestCount()Returns the number of timesorg.apache.jackrabbit.guava.common.cache.Cachelookup methods have returned either a cached or uncached value.longgetTotalLoadTime()Returns the total number of nanoseconds the cache has spent loading new values.voidresetStats()Reset the cache stats
-
-
-
Constructor Detail
-
CacheStatsMBeanWrapper
public CacheStatsMBeanWrapper(CacheStatsMBean delegate)
-
-
Method Detail
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceCacheStatsMBean
-
getRequestCount
public long getRequestCount()
Description copied from interface:CacheStatsMBeanReturns the number of timesorg.apache.jackrabbit.guava.common.cache.Cachelookup methods have returned either a cached or uncached value. This is defined asgetHitCount + getMissCount.- Specified by:
getRequestCountin interfaceCacheStatsMBean
-
getHitCount
public long getHitCount()
Description copied from interface:CacheStatsMBeanReturns the number of timesorg.apache.jackrabbit.guava.common.cache.Cachelookup methods have returned a cached value.- Specified by:
getHitCountin interfaceCacheStatsMBean
-
getHitRate
public double getHitRate()
Description copied from interface:CacheStatsMBeanReturns the ratio of cache requests which were hits. This is defined asgetHitCount / getRequestCount, or1.0whengetRequestCount == 0. Note thatgetHitRate + getMissRate =~ 1.0.- Specified by:
getHitRatein interfaceCacheStatsMBean
-
getMissCount
public long getMissCount()
Description copied from interface:CacheStatsMBeanReturns the number of timesorg.apache.jackrabbit.guava.common.cache.Cachelookup methods have returned an uncached (newly loaded) value, or null. Multiple concurrent calls toorg.apache.jackrabbit.guava.common.cache.Cachelookup methods on an absent value can result in multiple misses, all returning the results of a single cache load operation.- Specified by:
getMissCountin interfaceCacheStatsMBean
-
getMissRate
public double getMissRate()
Description copied from interface:CacheStatsMBeanReturns the ratio of cache requests which were misses. This is defined asgetMissCount / getRequestCount, or0.0whengetRequestCount == 0. Note thatgetHitRate + getMissRate =~ 1.0. Cache misses include all requests which weren't cache hits, including requests which resulted in either successful or failed loading attempts, and requests which waited for other threads to finish loading. It is thus the case thatgetMissCount >= getLoadSuccessCount + getLoadExceptionCount. Multiple concurrent misses for the same key will result in a single load operation.- Specified by:
getMissRatein interfaceCacheStatsMBean
-
getLoadCount
public long getLoadCount()
Description copied from interface:CacheStatsMBeanReturns the total number of times thatorg.apache.jackrabbit.guava.common.cache.Cachelookup methods attempted to load new values. This includes both successful load operations, as well as those that threw exceptions. This is defined asgetLoadSuccessCount + getLoadExceptionCount.- Specified by:
getLoadCountin interfaceCacheStatsMBean
-
getLoadSuccessCount
public long getLoadSuccessCount()
Description copied from interface:CacheStatsMBeanReturns the number of timesorg.apache.jackrabbit.guava.common.cache.Cachelookup methods have successfully loaded a new value. This is always incremented in conjunction withCacheStatsMBean.getMissCount(), thoughgetMissCountis also incremented when an exception is encountered during cache loading (seeCacheStatsMBean.getLoadExceptionCount()). Multiple concurrent misses for the same key will result in a single load operation.- Specified by:
getLoadSuccessCountin interfaceCacheStatsMBean
-
getLoadExceptionCount
public long getLoadExceptionCount()
Description copied from interface:CacheStatsMBeanReturns the number of timesorg.apache.jackrabbit.guava.common.cache.Cachelookup methods threw an exception while loading a new value. This is always incremented in conjunction withgetMissCount, thoughgetMissCountis also incremented when cache loading completes successfully (seeCacheStatsMBean.getLoadSuccessCount()). Multiple concurrent misses for the same key will result in a single load operation.- Specified by:
getLoadExceptionCountin interfaceCacheStatsMBean
-
getLoadExceptionRate
public double getLoadExceptionRate()
Description copied from interface:CacheStatsMBeanReturns the ratio of cache loading attempts which threw exceptions. This is defined asgetLoadExceptionCount / (getLoadSuccessCount + getLoadExceptionCount), or0.0whengetLoadSuccessCount + getLoadExceptionCount == 0.- Specified by:
getLoadExceptionRatein interfaceCacheStatsMBean
-
getTotalLoadTime
public long getTotalLoadTime()
Description copied from interface:CacheStatsMBeanReturns the total number of nanoseconds the cache has spent loading new values. This can be used to calculate the miss penalty. This value is increased every timegetLoadSuccessCountorgetLoadExceptionCountis incremented.- Specified by:
getTotalLoadTimein interfaceCacheStatsMBean
-
getAverageLoadPenalty
public double getAverageLoadPenalty()
Description copied from interface:CacheStatsMBeanReturns the average time spent loading new values. This is defined asgetTotalLoadTime / (getLoadSuccessCount + getLoadExceptionCount).- Specified by:
getAverageLoadPenaltyin interfaceCacheStatsMBean
-
getEvictionCount
public long getEvictionCount()
Description copied from interface:CacheStatsMBeanReturns the number of times an entry has been evicted. This count does not include manualorg.apache.jackrabbit.guava.common.cache.Cache#invalidate invalidations.- Specified by:
getEvictionCountin interfaceCacheStatsMBean
-
getElementCount
public long getElementCount()
Description copied from interface:CacheStatsMBeanGet the number of elements/objects in the cache.- Specified by:
getElementCountin interfaceCacheStatsMBean- Returns:
- the number of elements
-
getMaxTotalWeight
public long getMaxTotalWeight()
Description copied from interface:CacheStatsMBeanThe maximum weight of entries the cache may contain.- Specified by:
getMaxTotalWeightin interfaceCacheStatsMBean- Returns:
- the maximum total weight of entries the cache may contain
-
estimateCurrentWeight
public long estimateCurrentWeight()
Description copied from interface:CacheStatsMBeanTotal weight of the complete cache. Depending on implementation it might be the amount of RAM taken by the cache- Specified by:
estimateCurrentWeightin interfaceCacheStatsMBean- Returns:
- to weight of the cache
-
cacheInfoAsString
public java.lang.String cacheInfoAsString()
Description copied from interface:CacheStatsMBeanGathers the stats of the cache for logging.- Specified by:
cacheInfoAsStringin interfaceCacheStatsMBean
-
resetStats
public void resetStats()
Description copied from interface:CacheStatsMBeanReset the cache stats- Specified by:
resetStatsin interfaceCacheStatsMBean
-
-