Class CacheManagerSamplerImpl
- java.lang.Object
-
- net.sf.ehcache.management.sampled.CacheManagerSamplerImpl
-
- All Implemented Interfaces:
CacheManagerSampler
public class CacheManagerSamplerImpl extends java.lang.Object implements CacheManagerSampler
An implementation ofCacheManagerSampler- Author:
- Abhishek Sanoujam, byoukste
-
-
Constructor Summary
Constructors Constructor Description CacheManagerSamplerImpl(CacheManager cacheManager)Constructor taking the backingCacheManager
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearAll()Clears the contents of all caches in the CacheManager, but without removing any caches.java.lang.Object[][]executeQuery(java.lang.String queryString)Execute a BMSQL query against the CacheManager and return result grid.java.lang.StringgenerateActiveConfigDeclaration()generateActiveConfigDeclarationjava.lang.StringgenerateActiveConfigDeclaration(java.lang.String cacheName)generateActiveConfigDeclarationfloatgetCacheAverageGetTime()longgetCacheAverageSearchTime()longgetCacheEvictionRate()longgetCacheExpirationRate()longgetCacheHitRate()longgetCacheInMemoryHitRate()longgetCacheInMemoryMissRate()java.util.Map<java.lang.String,long[]>getCacheMetrics()Get a map of cache name to performance metrics (hits, misses).longgetCacheMissRate()java.lang.String[]getCacheNames()Gets the cache names managed by the CacheManagerlonggetCacheOffHeapHitRate()longgetCacheOffHeapMissRate()longgetCacheOnDiskHitRate()longgetCacheOnDiskMissRate()longgetCachePutRate()longgetCacheRemoveRate()longgetCacheSearchRate()longgetCacheUpdateRate()java.lang.StringgetClusterUUID()Gets the cluster uuid if applicable.booleangetHasWriteBehindWriter()Returns whether any caches are configured for write-behindlonggetMaxBytesLocalDisk()Maximum number of bytes of entries in the disk stores of all caches that did not declare their own max size.java.lang.StringgetMaxBytesLocalDiskAsString()longgetMaxBytesLocalHeap()Maximum number of bytes of entries in the heap memory stores of all caches that did not declare their own max size.java.lang.StringgetMaxBytesLocalHeapAsString()longgetMaxBytesLocalOffHeap()Maximum number of bytes of entries in the off-heap stores of all caches that did not declare their own max size.java.lang.StringgetMaxBytesLocalOffHeapAsString()java.lang.StringgetName()Gets the actual name of the cache manager.booleangetSearchable()java.lang.StringgetStatus()Gets the status attribute of the EhcachebooleangetTransactional()Are any of the caches transactionallonggetTransactionCommitRate()longgetTransactionCommittedCount()Get the committed transactions countlonggetTransactionRollbackRate()longgetTransactionRolledBackCount()Get the rolled back transactions countlonggetTransactionTimedOutCount()Get the timed out transactions count.intgetWriterMaxQueueSize()Maximum elements that can be queued for processing by the write-behind writerlonggetWriterQueueLength()Returns the total length of all write-behind queues across all cachesbooleanisEnabled()Returns if each cache is enabled.voidsetEnabled(boolean enabled)Enables/disables each cache contained by this CacheManagervoidsetMaxBytesLocalDisk(long maxBytes)voidsetMaxBytesLocalDiskAsString(java.lang.String maxBytes)voidsetMaxBytesLocalHeap(long maxBytes)voidsetMaxBytesLocalHeapAsString(java.lang.String maxBytes)voidshutdown()Shuts down the CacheManager.
-
-
-
Constructor Detail
-
CacheManagerSamplerImpl
public CacheManagerSamplerImpl(CacheManager cacheManager)
Constructor taking the backingCacheManager- Parameters:
cacheManager- to wrap
-
-
Method Detail
-
clearAll
public void clearAll()
Clears the contents of all caches in the CacheManager, but without removing any caches.This method is not synchronized. It only guarantees to clear those elements in a cache at the time that the
Ehcache.removeAll()mehod on each cache is called.- Specified by:
clearAllin interfaceCacheManagerSampler
-
getCacheNames
public java.lang.String[] getCacheNames() throws java.lang.IllegalStateExceptionGets the cache names managed by the CacheManager- Specified by:
getCacheNamesin interfaceCacheManagerSampler- Throws:
java.lang.IllegalStateException
-
getStatus
public java.lang.String getStatus()
Gets the status attribute of the Ehcache- Specified by:
getStatusin interfaceCacheManagerSampler- Returns:
- The status value, as a String from the Status enum class
-
shutdown
public void shutdown()
Shuts down the CacheManager.If the shutdown occurs on the singleton, then the singleton is removed, so that if a singleton access method is called, a new singleton will be created.
- Specified by:
shutdownin interfaceCacheManagerSampler
-
getCacheMetrics
public java.util.Map<java.lang.String,long[]> getCacheMetrics()
Get a map of cache name to performance metrics (hits, misses).- Specified by:
getCacheMetricsin interfaceCacheManagerSampler- Returns:
- a map of cache metrics
-
getCacheHitRate
public long getCacheHitRate()
- Specified by:
getCacheHitRatein interfaceCacheManagerSampler- Returns:
- aggregate hit rate
-
getCacheInMemoryHitRate
public long getCacheInMemoryHitRate()
- Specified by:
getCacheInMemoryHitRatein interfaceCacheManagerSampler- Returns:
- aggregate in-memory hit rate
-
getCacheOffHeapHitRate
public long getCacheOffHeapHitRate()
- Specified by:
getCacheOffHeapHitRatein interfaceCacheManagerSampler- Returns:
- aggregate off-heap hit rate
-
getCacheOnDiskHitRate
public long getCacheOnDiskHitRate()
- Specified by:
getCacheOnDiskHitRatein interfaceCacheManagerSampler- Returns:
- aggregate on-disk hit rate
-
getCacheMissRate
public long getCacheMissRate()
- Specified by:
getCacheMissRatein interfaceCacheManagerSampler- Returns:
- aggregate miss rate
-
getCacheInMemoryMissRate
public long getCacheInMemoryMissRate()
- Specified by:
getCacheInMemoryMissRatein interfaceCacheManagerSampler- Returns:
- aggregate in-memory miss rate
-
getCacheOffHeapMissRate
public long getCacheOffHeapMissRate()
- Specified by:
getCacheOffHeapMissRatein interfaceCacheManagerSampler- Returns:
- aggregate off-heap miss rate
-
getCacheOnDiskMissRate
public long getCacheOnDiskMissRate()
- Specified by:
getCacheOnDiskMissRatein interfaceCacheManagerSampler- Returns:
- aggregate on-disk miss rate
-
getCachePutRate
public long getCachePutRate()
- Specified by:
getCachePutRatein interfaceCacheManagerSampler- Returns:
- aggregate put rate
-
getCacheUpdateRate
public long getCacheUpdateRate()
- Specified by:
getCacheUpdateRatein interfaceCacheManagerSampler- Returns:
- aggregate update rate
-
getCacheRemoveRate
public long getCacheRemoveRate()
- Specified by:
getCacheRemoveRatein interfaceCacheManagerSampler- Returns:
- aggregate remove rate
-
getCacheEvictionRate
public long getCacheEvictionRate()
- Specified by:
getCacheEvictionRatein interfaceCacheManagerSampler- Returns:
- aggregate eviction rate
-
getCacheExpirationRate
public long getCacheExpirationRate()
- Specified by:
getCacheExpirationRatein interfaceCacheManagerSampler- Returns:
- aggregate expiration rate
-
getCacheAverageGetTime
public float getCacheAverageGetTime()
- Specified by:
getCacheAverageGetTimein interfaceCacheManagerSampler- Returns:
- aggregate average get time (ms.)
-
getCacheSearchRate
public long getCacheSearchRate()
- Specified by:
getCacheSearchRatein interfaceCacheManagerSampler- Returns:
- aggregate search rate
-
getCacheAverageSearchTime
public long getCacheAverageSearchTime()
- Specified by:
getCacheAverageSearchTimein interfaceCacheManagerSampler- Returns:
- aggregate search time
-
getHasWriteBehindWriter
public boolean getHasWriteBehindWriter()
Returns whether any caches are configured for write-behind- Specified by:
getHasWriteBehindWriterin interfaceCacheManagerSampler
-
getWriterQueueLength
public long getWriterQueueLength()
Returns the total length of all write-behind queues across all caches- Specified by:
getWriterQueueLengthin interfaceCacheManagerSampler- Returns:
- aggregate writer-behind queue length
-
getWriterMaxQueueSize
public int getWriterMaxQueueSize()
Maximum elements that can be queued for processing by the write-behind writer- Specified by:
getWriterMaxQueueSizein interfaceCacheManagerSampler- Returns:
- aggregate of the maximum elements that can be waiting to be processed by the write-behind writer across all caches
-
getMaxBytesLocalDisk
public long getMaxBytesLocalDisk()
Maximum number of bytes of entries in the disk stores of all caches that did not declare their own max size.- Specified by:
getMaxBytesLocalDiskin interfaceCacheManagerSampler- Returns:
- maximum number of bytes in the disk stores of all caches that did not declare their own max size.
-
getMaxBytesLocalDiskAsString
public java.lang.String getMaxBytesLocalDiskAsString()
- Specified by:
getMaxBytesLocalDiskAsStringin interfaceCacheManagerSampler- Returns:
- Original input for maxBytesLocalDisk
-
setMaxBytesLocalDisk
public void setMaxBytesLocalDisk(long maxBytes)
- Specified by:
setMaxBytesLocalDiskin interfaceCacheManagerSampler
-
setMaxBytesLocalDiskAsString
public void setMaxBytesLocalDiskAsString(java.lang.String maxBytes)
- Specified by:
setMaxBytesLocalDiskAsStringin interfaceCacheManagerSampler
-
getMaxBytesLocalHeap
public long getMaxBytesLocalHeap()
Maximum number of bytes of entries in the heap memory stores of all caches that did not declare their own max size.- Specified by:
getMaxBytesLocalHeapin interfaceCacheManagerSampler- Returns:
- maximum number of bytes in the heap memory stores of all caches that did not declare their own max size.
-
getMaxBytesLocalHeapAsString
public java.lang.String getMaxBytesLocalHeapAsString()
- Specified by:
getMaxBytesLocalHeapAsStringin interfaceCacheManagerSampler- Returns:
- Original input for maxBytesLocalHeap
-
setMaxBytesLocalHeap
public void setMaxBytesLocalHeap(long maxBytes)
- Specified by:
setMaxBytesLocalHeapin interfaceCacheManagerSampler
-
setMaxBytesLocalHeapAsString
public void setMaxBytesLocalHeapAsString(java.lang.String maxBytes)
- Specified by:
setMaxBytesLocalHeapAsStringin interfaceCacheManagerSampler
-
getMaxBytesLocalOffHeap
public long getMaxBytesLocalOffHeap()
Maximum number of bytes of entries in the off-heap stores of all caches that did not declare their own max size.- Specified by:
getMaxBytesLocalOffHeapin interfaceCacheManagerSampler- Returns:
- maximum number of bytes in the off-heap stores of all caches that did not declare their own max size.
-
getMaxBytesLocalOffHeapAsString
public java.lang.String getMaxBytesLocalOffHeapAsString()
- Specified by:
getMaxBytesLocalOffHeapAsStringin interfaceCacheManagerSampler- Returns:
- Original input for maxBytesLocalOffHeap
-
getName
public java.lang.String getName()
Gets the actual name of the cache manager.- Specified by:
getNamein interfaceCacheManagerSampler
-
getClusterUUID
public java.lang.String getClusterUUID()
Gets the cluster uuid if applicable.- Specified by:
getClusterUUIDin interfaceCacheManagerSampler- Returns:
- the cluster uuid
-
generateActiveConfigDeclaration
public java.lang.String generateActiveConfigDeclaration()
generateActiveConfigDeclaration- Specified by:
generateActiveConfigDeclarationin interfaceCacheManagerSampler- Returns:
- CacheManager configuration as String
-
generateActiveConfigDeclaration
public java.lang.String generateActiveConfigDeclaration(java.lang.String cacheName)
generateActiveConfigDeclaration- Specified by:
generateActiveConfigDeclarationin interfaceCacheManagerSampler- Returns:
- Cache configuration as String
-
getTransactional
public boolean getTransactional()
Are any of the caches transactional- Specified by:
getTransactionalin interfaceCacheManagerSampler- See Also:
CacheConfiguration.TransactionalMode
-
getSearchable
public boolean getSearchable()
- Specified by:
getSearchablein interfaceCacheManagerSampler- Returns:
- if any contained caches are configured for search
-
executeQuery
public java.lang.Object[][] executeQuery(java.lang.String queryString) throws SearchExceptionDescription copied from interface:CacheManagerSamplerExecute a BMSQL query against the CacheManager and return result grid.- Specified by:
executeQueryin interfaceCacheManagerSampler- Returns:
- query result grid
- Throws:
SearchException
-
getTransactionCommittedCount
public long getTransactionCommittedCount()
Get the committed transactions count- Specified by:
getTransactionCommittedCountin interfaceCacheManagerSampler- Returns:
- the committed transactions count
-
getTransactionCommitRate
public long getTransactionCommitRate()
- Specified by:
getTransactionCommitRatein interfaceCacheManagerSampler- Returns:
- aggregate Xa commit rate
-
getTransactionRolledBackCount
public long getTransactionRolledBackCount()
Get the rolled back transactions count- Specified by:
getTransactionRolledBackCountin interfaceCacheManagerSampler- Returns:
- the rolled back transactions count
-
getTransactionRollbackRate
public long getTransactionRollbackRate()
- Specified by:
getTransactionRollbackRatein interfaceCacheManagerSampler- Returns:
- aggregate Xa rollback rate
-
getTransactionTimedOutCount
public long getTransactionTimedOutCount()
Get the timed out transactions count. Note that only transactions which failed to commit due to a timeout are taken into account- Specified by:
getTransactionTimedOutCountin interfaceCacheManagerSampler- Returns:
- the timed out transactions count
-
isEnabled
public boolean isEnabled() throws CacheExceptionReturns if each cache is enabled.- Specified by:
isEnabledin interfaceCacheManagerSampler- Returns:
- boolean indicating that each cache is enabled
- Throws:
CacheException
-
setEnabled
public void setEnabled(boolean enabled)
Enables/disables each cache contained by this CacheManager- Specified by:
setEnabledin interfaceCacheManagerSampler
-
-