Class AbstractJmxCacheStatisticsProvider<C extends org.springframework.cache.Cache>
- java.lang.Object
- org.springframework.boot.actuate.cache.AbstractJmxCacheStatisticsProvider<C>
- Type Parameters:
C- The cache type
- All Implemented Interfaces:
CacheStatisticsProvider<C>
- Direct Known Subclasses:
InfinispanCacheStatisticsProvider,JCacheCacheStatisticsProvider
public abstract class AbstractJmxCacheStatisticsProvider<C extends org.springframework.cache.Cache> extends Object implements CacheStatisticsProvider<C>
BaseCacheStatisticsProviderimplementation that uses JMX to retrieve the cache statistics.- Since:
- 1.3.0
Constructor Summary
Constructors Constructor Description AbstractJmxCacheStatisticsProvider()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected <T> TgetAttribute(ObjectName objectName, String attributeName, Class<T> type)protected abstract CacheStatisticsgetCacheStatistics(ObjectName objectName)Return the currentCacheStatisticssnapshot from the MBean identified by the specifiedObjectName.CacheStatisticsgetCacheStatistics(org.springframework.cache.CacheManager cacheManager, C cache)Return the currentCacheStatisticssnapshot for the specifiedCacheornullif the given cache could not be handled.protected MBeanServergetMBeanServer()protected abstract ObjectNamegetObjectName(C cache)Return theObjectNameof the MBean that is managing the specified cache ornullif none is found.
Constructor Detail
AbstractJmxCacheStatisticsProvider
public AbstractJmxCacheStatisticsProvider()
Method Detail
getCacheStatistics
public CacheStatistics getCacheStatistics(org.springframework.cache.CacheManager cacheManager, C cache)
Description copied from interface:CacheStatisticsProviderReturn the currentCacheStatisticssnapshot for the specifiedCacheornullif the given cache could not be handled.- Specified by:
getCacheStatisticsin interfaceCacheStatisticsProvider<C extends org.springframework.cache.Cache>- Parameters:
cacheManager- theCacheManagerhandling this cachecache- the cache to handle- Returns:
- the current cache statistics or
null
getObjectName
protected abstract ObjectName getObjectName(C cache) throws MalformedObjectNameException
Return theObjectNameof the MBean that is managing the specified cache ornullif none is found.- Parameters:
cache- the cache to handle- Returns:
- the object name of the cache statistics MBean
- Throws:
MalformedObjectNameException- if theObjectNamefor that cache is invalid
getCacheStatistics
protected abstract CacheStatistics getCacheStatistics(ObjectName objectName)
Return the currentCacheStatisticssnapshot from the MBean identified by the specifiedObjectName.- Parameters:
objectName- the object name of the cache statistics MBean- Returns:
- the current cache statistics
getMBeanServer
protected MBeanServer getMBeanServer()
getAttribute
protected <T> T getAttribute(ObjectName objectName, String attributeName, Class<T> type)