Class EhcacheStatsImpl
- java.lang.Object
-
- javax.management.StandardMBean
-
- net.sf.ehcache.hibernate.management.impl.BaseEmitterBean
-
- net.sf.ehcache.hibernate.management.impl.EhcacheStatsImpl
-
- All Implemented Interfaces:
javax.management.DynamicMBean,javax.management.MBeanRegistration,javax.management.NotificationBroadcaster,javax.management.NotificationEmitter,EhcacheStats
public class EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats
Implementation ofEhcacheStats- Author:
- Abhishek Sanoujam
-
-
Field Summary
-
Fields inherited from class net.sf.ehcache.hibernate.management.impl.BaseEmitterBean
emitter, sequenceNumber
-
Fields inherited from interface net.sf.ehcache.hibernate.management.api.EhcacheStats
CACHE_ENABLED, CACHE_FLUSHED, CACHE_REGION_CHANGED, CACHE_REGION_FLUSHED, CACHE_STATISTICS_ENABLED, CACHE_STATISTICS_RESET
-
-
Constructor Summary
Constructors Constructor Description EhcacheStatsImpl(CacheManager manager)Constructor accepting the backingCacheManager
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoDispose()Dispose callback of subclassesvoidflushRegionCache(java.lang.String region)Flushes the cache for the input regionvoidflushRegionCaches()Flushes all the caches for all the regionsjava.lang.StringgenerateActiveConfigDeclaration()Returns the currently active cache configurationjava.lang.StringgenerateActiveConfigDeclaration(java.lang.String region)Returns the currently active cache configuration for the supplied regionfloatgetAverageGetTimeMillis(java.lang.String region)Return average time taken in milliseconds for a get operation for the input cache namelonggetCacheHitCount()Returns hit count for all the cachesdoublegetCacheHitRate()Returns hit rate for all the cacheslonggetCacheHitSample()Returns hit count sample for all the cacheslonggetCacheMissCount()Returns miss count for all the cachesdoublegetCacheMissRate()Returns miss rate for all the cacheslonggetCacheMissSample()Returns miss count sample for all the cacheslonggetCachePutCount()Returns put count for all the cachesdoublegetCachePutRate()Returns put rate for all the cacheslonggetCachePutSample()Returns put count sample for all the cacheslonggetMaxGetTimeMillis()Return maximum time taken in milliseconds for a get operationlonggetMaxGetTimeMillis(java.lang.String cacheName)Return maximum time taken in milliseconds for a get operation for the input cache namelonggetMinGetTimeMillis()Return minimum time taken for a get operation in the cache in millisecondslonggetMinGetTimeMillis(java.lang.String cacheName)Return minimum time taken in milliseconds for a get operation for the input cache namejavax.management.MBeanNotificationInfo[]getNotificationInfo()intgetNumberOfElementsInMemory(java.lang.String region)Returns number of elements in-memory in the cache for the input regionintgetNumberOfElementsOffHeap(java.lang.String region)Returns number of elements off-heap in the cache for the input regionintgetNumberOfElementsOnDisk(java.lang.String region)Returns number of elements on-disk in the cache for the input regionjava.lang.StringgetOriginalConfigDeclaration()Get the original cache configurationjava.lang.StringgetOriginalConfigDeclaration(java.lang.String region)Returns the original cache configuration for the supplied regionjava.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>getRegionCacheAttributes()Returns a map containing mapping of all cache region names to their attributesjava.util.Map<java.lang.String,java.lang.Object>getRegionCacheAttributes(java.lang.String regionName)Returns a map containing attributes of the cache for the input cache region nameintgetRegionCacheMaxTTISeconds(java.lang.String region)Returns the time to idle for the input cache regionintgetRegionCacheMaxTTLSeconds(java.lang.String region)Returns the time to live for the input cache regionintgetRegionCacheOrphanEvictionPeriod(java.lang.String region)Returns the orphan eviction period for the input cache region.java.util.Map<java.lang.String,int[]>getRegionCacheSamples()Returns a map containing mapping between cache names and an array containing hit, miss and put count samplesintgetRegionCacheTargetMaxInMemoryCount(java.lang.String region)Returns the maxElementsInMemory of the input cache regionintgetRegionCacheTargetMaxTotalCount(java.lang.String region)Returns the maxElementsOnDisk of the input cache regionjava.lang.String[]getTerracottaHibernateCacheRegionNames()Returns the region names which are clustered with terracottabooleanisRegionCacheEnabled(java.lang.String region)Returns true if cache is enabled for the input regionbooleanisRegionCacheLoggingEnabled(java.lang.String region)Returns true if logging is enabled for the input cache regionbooleanisRegionCacheOrphanEvictionEnabled(java.lang.String region)Returns true if orphan eviction is enabled for the region otherwise falsebooleanisRegionCachesEnabled()Returns true if all the cache regions are enabled.booleanisTerracottaHibernateCache(java.lang.String region)Returns true if the input region is clustered with terracottavoidsetRegionCacheEnabled(java.lang.String region, boolean enabled)Enables/disables a particular regionvoidsetRegionCacheLoggingEnabled(java.lang.String region, boolean loggingEnabled)Enable/Disable logging for the input cache regionvoidsetRegionCacheMaxTTISeconds(java.lang.String region, int maxTTISeconds)Sets the time to idle for the input cache regionvoidsetRegionCacheMaxTTLSeconds(java.lang.String region, int maxTTLSeconds)Sets the time to live for the input cache regionvoidsetRegionCachesEnabled(boolean flag)Enable/disable all the cache regions.voidsetRegionCacheTargetMaxInMemoryCount(java.lang.String region, int targetMaxInMemoryCount)Sets the maxElementsInMemory of the input cache regionvoidsetRegionCacheTargetMaxTotalCount(java.lang.String region, int targetMaxTotalCount)Sets the maxElementsOnDisk of the input cache region-
Methods inherited from class net.sf.ehcache.hibernate.management.impl.BaseEmitterBean
addNotificationListener, dispose, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification
-
Methods inherited from class javax.management.StandardMBean
cacheMBeanInfo, getAttribute, getAttributes, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getImpact, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, getParameterName, getParameterName, invoke, postDeregister, postRegister, preDeregister, preRegister, setAttribute, setAttributes, setImplementation
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
EhcacheStatsImpl
public EhcacheStatsImpl(CacheManager manager) throws javax.management.NotCompliantMBeanException
Constructor accepting the backingCacheManager- Throws:
javax.management.NotCompliantMBeanException
-
-
Method Detail
-
flushRegionCache
public void flushRegionCache(java.lang.String region)
Flushes the cache for the input region- Specified by:
flushRegionCachein interfaceEhcacheStats
-
flushRegionCaches
public void flushRegionCaches()
Flushes all the caches for all the regions- Specified by:
flushRegionCachesin interfaceEhcacheStats
-
generateActiveConfigDeclaration
public java.lang.String generateActiveConfigDeclaration()
Returns the currently active cache configuration- Specified by:
generateActiveConfigDeclarationin interfaceEhcacheStats- Returns:
- the currently active cache configuration
-
generateActiveConfigDeclaration
public java.lang.String generateActiveConfigDeclaration(java.lang.String region)
Returns the currently active cache configuration for the supplied region- Specified by:
generateActiveConfigDeclarationin interfaceEhcacheStats- Returns:
- Returns the currently active cache configuration for the supplied region
-
getCacheHitCount
public long getCacheHitCount()
Returns hit count for all the caches- Specified by:
getCacheHitCountin interfaceEhcacheStats- Returns:
- Returns hit count for all the caches
-
getCacheHitRate
public double getCacheHitRate()
Returns hit rate for all the caches- Specified by:
getCacheHitRatein interfaceEhcacheStats- Returns:
- Returns hit rate for all the caches
-
getCacheHitSample
public long getCacheHitSample()
Returns hit count sample for all the caches- Specified by:
getCacheHitSamplein interfaceEhcacheStats- Returns:
- Returns hit count sample for all the caches
-
getCacheMissCount
public long getCacheMissCount()
Returns miss count for all the caches- Specified by:
getCacheMissCountin interfaceEhcacheStats- Returns:
- Returns miss count for all the caches
-
getCacheMissRate
public double getCacheMissRate()
Returns miss rate for all the caches- Specified by:
getCacheMissRatein interfaceEhcacheStats- Returns:
- Returns miss rate for all the caches
-
getCacheMissSample
public long getCacheMissSample()
Returns miss count sample for all the caches- Specified by:
getCacheMissSamplein interfaceEhcacheStats- Returns:
- Returns miss count sample for all the caches
-
getCachePutCount
public long getCachePutCount()
Returns put count for all the caches- Specified by:
getCachePutCountin interfaceEhcacheStats- Returns:
- Returns put count for all the caches
-
getCachePutRate
public double getCachePutRate()
Returns put rate for all the caches- Specified by:
getCachePutRatein interfaceEhcacheStats- Returns:
- Returns put rate for all the caches
-
getCachePutSample
public long getCachePutSample()
Returns put count sample for all the caches- Specified by:
getCachePutSamplein interfaceEhcacheStats- Returns:
- Returns put count sample for all the caches
-
getOriginalConfigDeclaration
public java.lang.String getOriginalConfigDeclaration()
Get the original cache configuration- Specified by:
getOriginalConfigDeclarationin interfaceEhcacheStats- Returns:
- the original cache configuration
-
getOriginalConfigDeclaration
public java.lang.String getOriginalConfigDeclaration(java.lang.String region)
Returns the original cache configuration for the supplied region- Specified by:
getOriginalConfigDeclarationin interfaceEhcacheStats- Parameters:
region- for which the configuration is required- Returns:
- the original cache configuration for the supplied region
-
getRegionCacheAttributes
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> getRegionCacheAttributes()
Returns a map containing mapping of all cache region names to their attributes- Specified by:
getRegionCacheAttributesin interfaceEhcacheStats- Returns:
- Returns a map containing mapping of all cache region names to their attributes
-
getRegionCacheAttributes
public java.util.Map<java.lang.String,java.lang.Object> getRegionCacheAttributes(java.lang.String regionName)
Returns a map containing attributes of the cache for the input cache region name- Specified by:
getRegionCacheAttributesin interfaceEhcacheStats- Returns:
- Returns a map containing attributes of the cache for the input cache region name
-
getRegionCacheMaxTTISeconds
public int getRegionCacheMaxTTISeconds(java.lang.String region)
Returns the time to idle for the input cache region- Specified by:
getRegionCacheMaxTTISecondsin interfaceEhcacheStats- Returns:
- Returns the time to live for the input cache region
-
getRegionCacheMaxTTLSeconds
public int getRegionCacheMaxTTLSeconds(java.lang.String region)
Returns the time to live for the input cache region- Specified by:
getRegionCacheMaxTTLSecondsin interfaceEhcacheStats- Returns:
- Returns the time to live for the input cache region
-
getRegionCacheOrphanEvictionPeriod
public int getRegionCacheOrphanEvictionPeriod(java.lang.String region)
Returns the orphan eviction period for the input cache region.- Specified by:
getRegionCacheOrphanEvictionPeriodin interfaceEhcacheStats- Returns:
- Returns the orphan eviction period for the input cache region.
-
getRegionCacheSamples
public java.util.Map<java.lang.String,int[]> getRegionCacheSamples()
Returns a map containing mapping between cache names and an array containing hit, miss and put count samples- Specified by:
getRegionCacheSamplesin interfaceEhcacheStats- Returns:
- Returns a map containing mapping between cache names and an array containing hit, miss and put count samples
-
getRegionCacheTargetMaxInMemoryCount
public int getRegionCacheTargetMaxInMemoryCount(java.lang.String region)
Returns the maxElementsInMemory of the input cache region- Specified by:
getRegionCacheTargetMaxInMemoryCountin interfaceEhcacheStats- Returns:
- Returns the maxElementsInMemory of the input cache region
-
getRegionCacheTargetMaxTotalCount
public int getRegionCacheTargetMaxTotalCount(java.lang.String region)
Returns the maxElementsOnDisk of the input cache region- Specified by:
getRegionCacheTargetMaxTotalCountin interfaceEhcacheStats- Returns:
- Returns the maxElementsOnDisk of the input cache region
-
getTerracottaHibernateCacheRegionNames
public java.lang.String[] getTerracottaHibernateCacheRegionNames()
Returns the region names which are clustered with terracotta- Specified by:
getTerracottaHibernateCacheRegionNamesin interfaceEhcacheStats- Returns:
- Returns the region names which are clustered with terracotta
-
isRegionCacheEnabled
public boolean isRegionCacheEnabled(java.lang.String region)
Returns true if cache is enabled for the input region- Specified by:
isRegionCacheEnabledin interfaceEhcacheStats- Returns:
- Returns true if cache is enabled for the input region
-
setRegionCacheEnabled
public void setRegionCacheEnabled(java.lang.String region, boolean enabled)Enables/disables a particular region- Specified by:
setRegionCacheEnabledin interfaceEhcacheStats
-
isRegionCachesEnabled
public boolean isRegionCachesEnabled()
Returns true if all the cache regions are enabled. If even one cache is disabled, it will return false- Specified by:
isRegionCachesEnabledin interfaceEhcacheStats- Returns:
- Returns true if all the cache regions are enabled. If even one cache is disabled, it will return false
-
setRegionCachesEnabled
public void setRegionCachesEnabled(boolean flag)
Description copied from interface:EhcacheStatsEnable/disable all the cache regions.- Specified by:
setRegionCachesEnabledin interfaceEhcacheStats- See Also:
EhcacheStats.setRegionCachesEnabled(boolean)
-
isRegionCacheLoggingEnabled
public boolean isRegionCacheLoggingEnabled(java.lang.String region)
Returns true if logging is enabled for the input cache region- Specified by:
isRegionCacheLoggingEnabledin interfaceEhcacheStats- Returns:
- Returns true if logging is enabled for the input cache region
-
isRegionCacheOrphanEvictionEnabled
public boolean isRegionCacheOrphanEvictionEnabled(java.lang.String region)
Returns true if orphan eviction is enabled for the region otherwise false- Specified by:
isRegionCacheOrphanEvictionEnabledin interfaceEhcacheStats- Returns:
- Returns true if orphan eviction is enabled for the region otherwise false
-
isTerracottaHibernateCache
public boolean isTerracottaHibernateCache(java.lang.String region)
Returns true if the input region is clustered with terracotta- Specified by:
isTerracottaHibernateCachein interfaceEhcacheStats- Returns:
- Returns true if the input region is clustered with terracotta
-
setRegionCacheLoggingEnabled
public void setRegionCacheLoggingEnabled(java.lang.String region, boolean loggingEnabled)Enable/Disable logging for the input cache region- Specified by:
setRegionCacheLoggingEnabledin interfaceEhcacheStats
-
setRegionCacheMaxTTISeconds
public void setRegionCacheMaxTTISeconds(java.lang.String region, int maxTTISeconds)Sets the time to idle for the input cache region- Specified by:
setRegionCacheMaxTTISecondsin interfaceEhcacheStatsmaxTTISeconds- Returns the time to idle for the input cache region
-
setRegionCacheMaxTTLSeconds
public void setRegionCacheMaxTTLSeconds(java.lang.String region, int maxTTLSeconds)Sets the time to live for the input cache region- Specified by:
setRegionCacheMaxTTLSecondsin interfaceEhcacheStats
-
setRegionCacheTargetMaxInMemoryCount
public void setRegionCacheTargetMaxInMemoryCount(java.lang.String region, int targetMaxInMemoryCount)Sets the maxElementsInMemory of the input cache region- Specified by:
setRegionCacheTargetMaxInMemoryCountin interfaceEhcacheStats
-
setRegionCacheTargetMaxTotalCount
public void setRegionCacheTargetMaxTotalCount(java.lang.String region, int targetMaxTotalCount)Sets the maxElementsOnDisk of the input cache region- Specified by:
setRegionCacheTargetMaxTotalCountin interfaceEhcacheStats
-
getNumberOfElementsInMemory
public int getNumberOfElementsInMemory(java.lang.String region)
Returns number of elements in-memory in the cache for the input region- Specified by:
getNumberOfElementsInMemoryin interfaceEhcacheStats- Returns:
- Returns number of elements in-memory in the cache for the input region
- See Also:
EhcacheStats.getNumberOfElementsInMemory(java.lang.String)
-
getNumberOfElementsOffHeap
public int getNumberOfElementsOffHeap(java.lang.String region)
Returns number of elements off-heap in the cache for the input region- Specified by:
getNumberOfElementsOffHeapin interfaceEhcacheStats- Returns:
- Returns number of elements off-heap in the cache for the input region
- See Also:
EhcacheStats.getNumberOfElementsOffHeap(java.lang.String)
-
getNumberOfElementsOnDisk
public int getNumberOfElementsOnDisk(java.lang.String region)
Returns number of elements on-disk in the cache for the input region- Specified by:
getNumberOfElementsOnDiskin interfaceEhcacheStats- Returns:
- Returns number of elements on-disk in the cache for the input region
- See Also:
EhcacheStats.getNumberOfElementsOnDisk(java.lang.String)
-
getMaxGetTimeMillis
public long getMaxGetTimeMillis()
Return maximum time taken in milliseconds for a get operation- Specified by:
getMaxGetTimeMillisin interfaceEhcacheStats- Returns:
- Return maximum time taken in milliseconds for a get operation
-
getMinGetTimeMillis
public long getMinGetTimeMillis()
Return minimum time taken for a get operation in the cache in milliseconds- Specified by:
getMinGetTimeMillisin interfaceEhcacheStats- Returns:
- minimum time taken for a get operation in the cache in milliseconds
-
getMaxGetTimeMillis
public long getMaxGetTimeMillis(java.lang.String cacheName)
Return maximum time taken in milliseconds for a get operation for the input cache name- Specified by:
getMaxGetTimeMillisin interfaceEhcacheStats- Returns:
- Return maximum time taken in milliseconds for a get operation for the input cache name
- See Also:
EhcacheStats.getMaxGetTimeMillis(java.lang.String)
-
getMinGetTimeMillis
public long getMinGetTimeMillis(java.lang.String cacheName)
Return minimum time taken in milliseconds for a get operation for the input cache name- Specified by:
getMinGetTimeMillisin interfaceEhcacheStats- Returns:
- Return minimum time taken in milliseconds for a get operation for the input cache name
- See Also:
EhcacheStats.getMinGetTimeMillis(java.lang.String)
-
getAverageGetTimeMillis
public float getAverageGetTimeMillis(java.lang.String region)
Return average time taken in milliseconds for a get operation for the input cache name- Specified by:
getAverageGetTimeMillisin interfaceEhcacheStats- Returns:
- Return average time taken in milliseconds for a get operation for the input cache name
- See Also:
EhcacheStats.getAverageGetTimeMillis(java.lang.String)
-
doDispose
protected void doDispose()
Dispose callback of subclasses- Specified by:
doDisposein classBaseEmitterBean
-
getNotificationInfo
public javax.management.MBeanNotificationInfo[] getNotificationInfo()
- Specified by:
getNotificationInfoin interfacejavax.management.NotificationBroadcaster- Specified by:
getNotificationInfoin classBaseEmitterBean- See Also:
BaseEmitterBean.getNotificationInfo()
-
-