ehcache

net.sf.ehcache.management.sampled
Class CacheManagerSamplerImpl

java.lang.Object
  extended by net.sf.ehcache.management.sampled.CacheManagerSamplerImpl
All Implemented Interfaces:
CacheManagerSampler

public class CacheManagerSamplerImpl
extends Object
implements CacheManagerSampler

An implementation of CacheManagerSampler

Author:
Abhishek Sanoujam, byoukste

Constructor Summary
CacheManagerSamplerImpl(CacheManager cacheManager)
          Constructor taking the backing CacheManager
 
Method Summary
 void clearAll()
          Clears the contents of all caches in the CacheManager, but without removing any caches.
 Object[][] executeQuery(String queryString)
          Execute a BMSQL query against the CacheManager and return result grid.
 String generateActiveConfigDeclaration()
          generateActiveConfigDeclaration
 String generateActiveConfigDeclaration(String cacheName)
          generateActiveConfigDeclaration
 float getCacheAverageGetTime()
          
 long getCacheAverageSearchTime()
          
 long getCacheEvictionRate()
          
 long getCacheExpirationRate()
          
 long getCacheHitRate()
          
 long getCacheInMemoryHitRate()
          
 long getCacheInMemoryMissRate()
          
 Map<String,long[]> getCacheMetrics()
          Get a map of cache name to performance metrics (hits, misses).
 long getCacheMissRate()
          
 String[] getCacheNames()
          Gets the cache names managed by the CacheManager
 long getCacheOffHeapHitRate()
          
 long getCacheOffHeapMissRate()
          
 long getCacheOnDiskHitRate()
          
 long getCacheOnDiskMissRate()
          
 long getCachePutRate()
          
 long getCacheRemoveRate()
          
 long getCacheSearchRate()
          
 long getCacheUpdateRate()
          
 String getClusterUUID()
          Gets the cluster uuid if applicable.
 boolean getHasWriteBehindWriter()
          Returns whether any caches are configured for write-behind
 long getMaxBytesLocalDisk()
          Maximum number of bytes of entries in the disk stores of all caches that did not declare their own max size.
 String getMaxBytesLocalDiskAsString()
          
 long getMaxBytesLocalHeap()
          Maximum number of bytes of entries in the heap memory stores of all caches that did not declare their own max size.
 String getMaxBytesLocalHeapAsString()
          
 long getMaxBytesLocalOffHeap()
          Maximum number of bytes of entries in the off-heap stores of all caches that did not declare their own max size.
 String getMaxBytesLocalOffHeapAsString()
          
 String getName()
          Gets the actual name of the cache manager.
 boolean getSearchable()
          
 String getStatus()
          Gets the status attribute of the Ehcache
 boolean getTransactional()
          Are any of the caches transactional
 long getTransactionCommitRate()
          
 long getTransactionCommittedCount()
          Get the committed transactions count
 long getTransactionRollbackRate()
          
 long getTransactionRolledBackCount()
          Get the rolled back transactions count
 long getTransactionTimedOutCount()
          Get the timed out transactions count.
 int getWriterMaxQueueSize()
          Maximum elements that can be queued for processing by the write-behind writer
 long getWriterQueueLength()
          Returns the total length of all write-behind queues across all caches
 boolean isEnabled()
          Returns if each cache is enabled.
 void setEnabled(boolean enabled)
          Enables/disables each cache contained by this CacheManager
 void setMaxBytesLocalDisk(long maxBytes)
          
 void setMaxBytesLocalDiskAsString(String maxBytes)
          
 void setMaxBytesLocalHeap(long maxBytes)
          
 void setMaxBytesLocalHeapAsString(String maxBytes)
          
 void shutdown()
          Shuts down the CacheManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheManagerSamplerImpl

public CacheManagerSamplerImpl(CacheManager cacheManager)
Constructor taking the backing CacheManager

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:
clearAll in interface CacheManagerSampler

getCacheNames

public String[] getCacheNames()
                       throws IllegalStateException
Gets the cache names managed by the CacheManager

Specified by:
getCacheNames in interface CacheManagerSampler
Throws:
IllegalStateException

getStatus

public String getStatus()
Gets the status attribute of the Ehcache

Specified by:
getStatus in interface CacheManagerSampler
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:
shutdown in interface CacheManagerSampler

getCacheMetrics

public Map<String,long[]> getCacheMetrics()
Get a map of cache name to performance metrics (hits, misses).

Specified by:
getCacheMetrics in interface CacheManagerSampler
Returns:
a map of cache metrics

getCacheHitRate

public long getCacheHitRate()

Specified by:
getCacheHitRate in interface CacheManagerSampler
Returns:
aggregate hit rate

getCacheInMemoryHitRate

public long getCacheInMemoryHitRate()

Specified by:
getCacheInMemoryHitRate in interface CacheManagerSampler
Returns:
aggregate in-memory hit rate

getCacheOffHeapHitRate

public long getCacheOffHeapHitRate()

Specified by:
getCacheOffHeapHitRate in interface CacheManagerSampler
Returns:
aggregate off-heap hit rate

getCacheOnDiskHitRate

public long getCacheOnDiskHitRate()

Specified by:
getCacheOnDiskHitRate in interface CacheManagerSampler
Returns:
aggregate on-disk hit rate

getCacheMissRate

public long getCacheMissRate()

Specified by:
getCacheMissRate in interface CacheManagerSampler
Returns:
aggregate miss rate

getCacheInMemoryMissRate

public long getCacheInMemoryMissRate()

Specified by:
getCacheInMemoryMissRate in interface CacheManagerSampler
Returns:
aggregate in-memory miss rate

getCacheOffHeapMissRate

public long getCacheOffHeapMissRate()

Specified by:
getCacheOffHeapMissRate in interface CacheManagerSampler
Returns:
aggregate off-heap miss rate

getCacheOnDiskMissRate

public long getCacheOnDiskMissRate()

Specified by:
getCacheOnDiskMissRate in interface CacheManagerSampler
Returns:
aggregate on-disk miss rate

getCachePutRate

public long getCachePutRate()

Specified by:
getCachePutRate in interface CacheManagerSampler
Returns:
aggregate put rate

getCacheUpdateRate

public long getCacheUpdateRate()

Specified by:
getCacheUpdateRate in interface CacheManagerSampler
Returns:
aggregate update rate

getCacheRemoveRate

public long getCacheRemoveRate()

Specified by:
getCacheRemoveRate in interface CacheManagerSampler
Returns:
aggregate remove rate

getCacheEvictionRate

public long getCacheEvictionRate()

Specified by:
getCacheEvictionRate in interface CacheManagerSampler
Returns:
aggregate eviction rate

getCacheExpirationRate

public long getCacheExpirationRate()

Specified by:
getCacheExpirationRate in interface CacheManagerSampler
Returns:
aggregate expiration rate

getCacheAverageGetTime

public float getCacheAverageGetTime()

Specified by:
getCacheAverageGetTime in interface CacheManagerSampler
Returns:
aggregate average get time (ms.)

getCacheSearchRate

public long getCacheSearchRate()

Specified by:
getCacheSearchRate in interface CacheManagerSampler
Returns:
aggregate search rate

getCacheAverageSearchTime

public long getCacheAverageSearchTime()

Specified by:
getCacheAverageSearchTime in interface CacheManagerSampler
Returns:
aggregate search time

getHasWriteBehindWriter

public boolean getHasWriteBehindWriter()
Returns whether any caches are configured for write-behind

Specified by:
getHasWriteBehindWriter in interface CacheManagerSampler

getWriterQueueLength

public long getWriterQueueLength()
Returns the total length of all write-behind queues across all caches

Specified by:
getWriterQueueLength in interface CacheManagerSampler
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:
getWriterMaxQueueSize in interface CacheManagerSampler
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:
getMaxBytesLocalDisk in interface CacheManagerSampler
Returns:
maximum number of bytes in the disk stores of all caches that did not declare their own max size.

getMaxBytesLocalDiskAsString

public String getMaxBytesLocalDiskAsString()

Specified by:
getMaxBytesLocalDiskAsString in interface CacheManagerSampler
Returns:
Original input for maxBytesLocalDisk

setMaxBytesLocalDisk

public void setMaxBytesLocalDisk(long maxBytes)

Specified by:
setMaxBytesLocalDisk in interface CacheManagerSampler

setMaxBytesLocalDiskAsString

public void setMaxBytesLocalDiskAsString(String maxBytes)

Specified by:
setMaxBytesLocalDiskAsString in interface CacheManagerSampler

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:
getMaxBytesLocalHeap in interface CacheManagerSampler
Returns:
maximum number of bytes in the heap memory stores of all caches that did not declare their own max size.

getMaxBytesLocalHeapAsString

public String getMaxBytesLocalHeapAsString()

Specified by:
getMaxBytesLocalHeapAsString in interface CacheManagerSampler
Returns:
Original input for maxBytesLocalHeap

setMaxBytesLocalHeap

public void setMaxBytesLocalHeap(long maxBytes)

Specified by:
setMaxBytesLocalHeap in interface CacheManagerSampler

setMaxBytesLocalHeapAsString

public void setMaxBytesLocalHeapAsString(String maxBytes)

Specified by:
setMaxBytesLocalHeapAsString in interface CacheManagerSampler

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:
getMaxBytesLocalOffHeap in interface CacheManagerSampler
Returns:
maximum number of bytes in the off-heap stores of all caches that did not declare their own max size.

getMaxBytesLocalOffHeapAsString

public String getMaxBytesLocalOffHeapAsString()

Specified by:
getMaxBytesLocalOffHeapAsString in interface CacheManagerSampler
Returns:
Original input for maxBytesLocalOffHeap

getName

public String getName()
Gets the actual name of the cache manager.

Specified by:
getName in interface CacheManagerSampler

getClusterUUID

public String getClusterUUID()
Gets the cluster uuid if applicable.

Specified by:
getClusterUUID in interface CacheManagerSampler
Returns:
the cluster uuid

generateActiveConfigDeclaration

public String generateActiveConfigDeclaration()
generateActiveConfigDeclaration

Specified by:
generateActiveConfigDeclaration in interface CacheManagerSampler
Returns:
CacheManager configuration as String

generateActiveConfigDeclaration

public String generateActiveConfigDeclaration(String cacheName)
generateActiveConfigDeclaration

Specified by:
generateActiveConfigDeclaration in interface CacheManagerSampler
Returns:
Cache configuration as String

getTransactional

public boolean getTransactional()
Are any of the caches transactional

Specified by:
getTransactional in interface CacheManagerSampler
See Also:
CacheConfiguration.TransactionalMode

getSearchable

public boolean getSearchable()

Specified by:
getSearchable in interface CacheManagerSampler
Returns:
if any contained caches are configured for search

executeQuery

public Object[][] executeQuery(String queryString)
                        throws SearchException
Description copied from interface: CacheManagerSampler
Execute a BMSQL query against the CacheManager and return result grid.

Specified by:
executeQuery in interface CacheManagerSampler
Returns:
query result grid
Throws:
SearchException

getTransactionCommittedCount

public long getTransactionCommittedCount()
Get the committed transactions count

Specified by:
getTransactionCommittedCount in interface CacheManagerSampler
Returns:
the committed transactions count

getTransactionCommitRate

public long getTransactionCommitRate()

Specified by:
getTransactionCommitRate in interface CacheManagerSampler
Returns:
aggregate Xa commit rate

getTransactionRolledBackCount

public long getTransactionRolledBackCount()
Get the rolled back transactions count

Specified by:
getTransactionRolledBackCount in interface CacheManagerSampler
Returns:
the rolled back transactions count

getTransactionRollbackRate

public long getTransactionRollbackRate()

Specified by:
getTransactionRollbackRate in interface CacheManagerSampler
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:
getTransactionTimedOutCount in interface CacheManagerSampler
Returns:
the timed out transactions count

isEnabled

public boolean isEnabled()
                  throws CacheException
Returns if each cache is enabled.

Specified by:
isEnabled in interface CacheManagerSampler
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:
setEnabled in interface CacheManagerSampler

ehcache

Copyright 2001-2016, Terracotta, Inc.