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>
BaseCacheStatisticsProvider
implementation 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> T
getAttribute(ObjectName objectName, String attributeName, Class<T> type)
protected abstract CacheStatistics
getCacheStatistics(ObjectName objectName)
Return the currentCacheStatistics
snapshot from the MBean identified by the specifiedObjectName
.CacheStatistics
getCacheStatistics(org.springframework.cache.CacheManager cacheManager, C cache)
Return the currentCacheStatistics
snapshot for the specifiedCache
ornull
if the given cache could not be handled.protected MBeanServer
getMBeanServer()
protected abstract ObjectName
getObjectName(C cache)
Return theObjectName
of the MBean that is managing the specified cache ornull
if 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:CacheStatisticsProvider
Return the currentCacheStatistics
snapshot for the specifiedCache
ornull
if the given cache could not be handled.- Specified by:
getCacheStatistics
in interfaceCacheStatisticsProvider<C extends org.springframework.cache.Cache>
- Parameters:
cacheManager
- theCacheManager
handling this cachecache
- the cache to handle- Returns:
- the current cache statistics or
null
getObjectName
protected abstract ObjectName getObjectName(C cache) throws MalformedObjectNameException
Return theObjectName
of the MBean that is managing the specified cache ornull
if none is found.- Parameters:
cache
- the cache to handle- Returns:
- the object name of the cache statistics MBean
- Throws:
MalformedObjectNameException
- if theObjectName
for that cache is invalid
getCacheStatistics
protected abstract CacheStatistics getCacheStatistics(ObjectName objectName)
Return the currentCacheStatistics
snapshot 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)