|
ehcache | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.ehcache.statistics.LiveCacheStatisticsWrapper
public class LiveCacheStatisticsWrapper
An implementation of LiveCacheStatistics and also implements LiveCacheStatisticsData. Uses separate delegates depending
on whether
statistics is enabled or not.
| Constructor Summary | |
|---|---|
LiveCacheStatisticsWrapper(Ehcache cache)
Constructor accepting the backing cache. |
|
| Method Summary | |
|---|---|
void |
addGetTimeMillis(long millis)
Adds time taken for a get operation in the cache |
void |
addGetTimeNanos(long nanos)
Adds time taken for a get operation in the cache |
void |
cacheHitInMemory()
Called on a cache hit in the MemoryStore |
void |
cacheHitOffHeap()
Called on a cache hit in the off-heap |
void |
cacheHitOnDisk()
Called on a cache hit in the DiskStore |
void |
cacheMissExpired()
Called when an element is found in the cache but already expired |
void |
cacheMissInMemory()
Called on a cache miss in the MemoryStore |
void |
cacheMissNotFound()
Called when an element is not found in the cache |
void |
cacheMissOffHeap()
Called on a cache miss in the off-heap |
void |
cacheMissOnDisk()
Called on a cache miss in the DiskStore |
void |
clearStatistics()
Clears statistics of this cache |
Object |
clone()
Creates a clone of this listener. |
void |
dispose()
Give the listener a chance to cleanup and free resources when no longer needed |
float |
getAverageGetTimeMillis()
Average time in milliseconds taken to get an element from the cache. |
long |
getAverageGetTimeNanos()
Average time in nanoseconds taken to get an element from the cache. |
long |
getCacheHitCount()
The number of times a requested item was found in the cache. |
int |
getCacheHitRatio()
The ratio of hits to accesses (hits + misses). |
long |
getCacheMissCount()
Number of times a requested element was not found in the cache. |
long |
getCacheMissCountExpired()
|
String |
getCacheName()
|
long |
getEvictedCount()
Number of elements evicted from the cache |
long |
getExpiredCount()
Number of elements expired since creation or last clear |
long |
getInMemoryHitCount()
Number of times a requested item was found in the Memory Store. |
long |
getInMemoryMissCount()
Number of times a requested item was not found in the Memory Store. |
long |
getInMemorySize()
Deprecated. see getLocalHeapSize() |
long |
getLocalDiskSize()
Number of entries in the DiskStore |
long |
getLocalDiskSizeInBytes()
Returns the usage of local disks in bytes |
long |
getLocalHeapSize()
Number of entries in the MemoryStore |
long |
getLocalHeapSizeInBytes()
Returns the usage of local heap in bytes |
long |
getLocalOffHeapSize()
Number of entries in the off-heap store |
long |
getLocalOffHeapSizeInBytes()
Returns the usage of local off heap in bytes |
long |
getMaxGetTimeMillis()
Deprecated. |
long |
getMaxGetTimeNanos()
Return maximum time taken for a get operation in the cache in milliseconds |
long |
getMinGetTimeMillis()
Deprecated. |
long |
getMinGetTimeNanos()
Return minimum time taken for a get operation in the cache in nanoseconds |
long |
getOffHeapHitCount()
Number of times a requested item was found in the off-heap store. |
long |
getOffHeapMissCount()
Number of times a requested item was not found in the off-heap store. |
long |
getOffHeapSize()
Deprecated. see getLocalOffHeapSize() |
long |
getOnDiskHitCount()
Number of times a requested item was found in the Disk Store. |
long |
getOnDiskMissCount()
Number of times a requested item was not found in the Disk Store. |
long |
getOnDiskSize()
Deprecated. see getLocalDiskSize() |
long |
getPutCount()
Number of puts that has happened in the cache |
long |
getRemovedCount()
Number of elements removed since creation or last clear |
long |
getSize()
Size of the cache based on current accuracy settings. |
int |
getStatisticsAccuracy()
Accurately measuring statistics can be expensive. |
String |
getStatisticsAccuracyDescription()
Accurately measuring statistics can be expensive. |
long |
getUpdateCount()
Number of updates that as happened in the cache |
long |
getWriterQueueLength()
Gets the size of the write-behind queue, if any. |
long |
getXaCommitCount()
Return the Cache's XAResource commit calls count |
long |
getXaRecoveredCount()
Return the Cache's XAResource recovered XIDs count |
long |
getXaRollbackCount()
Return the Cache's XAResource rollback calls count |
boolean |
isStatisticsEnabled()
Returns true if statistics is enabled |
void |
notifyElementEvicted(Ehcache cache,
Element element)
Called immediately after an element is evicted from the cache. |
void |
notifyElementExpired(Ehcache cache,
Element element)
Called immediately after an element is found to be expired. |
void |
notifyElementPut(Ehcache cache,
Element element)
Called immediately after an element has been put into the cache. |
void |
notifyElementRemoved(Ehcache cache,
Element element)
Called immediately after an attempt to remove an element. |
void |
notifyElementUpdated(Ehcache cache,
Element element)
Called immediately after an element has been put into the cache and the element already existed in the cache. |
void |
notifyRemoveAll(Ehcache cache)
Called during Ehcache.removeAll() to indicate that the all
elements have been removed from the cache in a bulk operation. |
void |
registerCacheUsageListener(CacheUsageListener cacheUsageListener)
Registers a CacheUsageListener which will be notified of the
cache
usage. |
void |
removeCacheUsageListener(CacheUsageListener cacheUsageListener)
Remove an already registered CacheUsageListener, if any. |
void |
setStatisticsAccuracy(int statisticsAccuracy)
Sets the statistics accuracy. |
void |
setStatisticsEnabled(boolean enableStatistics)
Enabled/Disabled statistics |
void |
xaCommit()
Called when the Cache's XAResource has been asked to commit |
void |
xaRecovered(int count)
Called when the Cache's XAResource has recovered one or more XID |
void |
xaRollback()
Called when the Cache's XAResource has been asked to rollback |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LiveCacheStatisticsWrapper(Ehcache cache)
cache - | Method Detail |
|---|
public void setStatisticsEnabled(boolean enableStatistics)
setStatisticsEnabled in interface LiveCacheStatisticsDataLiveCacheStatisticsData.setStatisticsEnabled(boolean)public boolean isStatisticsEnabled()
isStatisticsEnabled in interface LiveCacheStatisticsLiveCacheStatistics.isStatisticsEnabled()
public void registerCacheUsageListener(CacheUsageListener cacheUsageListener)
throws IllegalStateException
CacheUsageListener which will be notified of the
cache
usage.
Implementations of CacheUsageListener should override the Object.equals(Object) and Object.hashCode() methods
as it is used for
equality check
registerCacheUsageListener in interface LiveCacheStatisticsDataIllegalStateExceptionLiveCacheStatisticsData.registerCacheUsageListener(net.sf.ehcache.statistics.CacheUsageListener)
public void removeCacheUsageListener(CacheUsageListener cacheUsageListener)
throws IllegalStateException
CacheUsageListener, if any.
Depends on the Object.equals(Object) method.
removeCacheUsageListener in interface LiveCacheStatisticsDataIllegalStateExceptionLiveCacheStatisticsData.removeCacheUsageListener(net.sf.ehcache.statistics.CacheUsageListener)public void setStatisticsAccuracy(int statisticsAccuracy)
setStatisticsAccuracy in interface LiveCacheStatisticsDatastatisticsAccuracy - one of Statistics#STATISTICS_ACCURACY_BEST_EFFORT,
Statistics#STATISTICS_ACCURACY_GUARANTEED,
Statistics#STATISTICS_ACCURACY_NONELiveCacheStatisticsData.setStatisticsAccuracy(int)public int getStatisticsAccuracy()
getStatisticsAccuracy in interface LiveCacheStatisticsLiveCacheStatistics.getStatisticsAccuracy()public String getStatisticsAccuracyDescription()
getStatisticsAccuracyDescription in interface LiveCacheStatisticsLiveCacheStatistics.getStatisticsAccuracyDescription()public String getCacheName()
getCacheName in interface LiveCacheStatisticsLiveCacheStatistics.getCacheName()public long getSize()
getSize in interface LiveCacheStatisticsLiveCacheStatistics.getSize()@Deprecated public long getInMemorySize()
getLocalHeapSize()
getInMemorySize in interface LiveCacheStatisticsLiveCacheStatistics.getInMemorySize()@Deprecated public long getOffHeapSize()
getLocalOffHeapSize()
getOffHeapSize in interface LiveCacheStatisticsLiveCacheStatistics.getOffHeapSize()@Deprecated public long getOnDiskSize()
getLocalDiskSize()
getOnDiskSize in interface LiveCacheStatisticsLiveCacheStatistics.getOnDiskSize()public long getLocalHeapSize()
getLocalHeapSize in interface LiveCacheStatisticspublic long getLocalOffHeapSize()
getLocalOffHeapSize in interface LiveCacheStatisticspublic long getLocalDiskSize()
getLocalDiskSize in interface LiveCacheStatisticspublic long getLocalHeapSizeInBytes()
getLocalHeapSizeInBytes in interface LiveCacheStatisticspublic long getLocalOffHeapSizeInBytes()
getLocalOffHeapSizeInBytes in interface LiveCacheStatisticspublic long getLocalDiskSizeInBytes()
getLocalDiskSizeInBytes in interface LiveCacheStatisticspublic float getAverageGetTimeMillis()
getAverageGetTimeMillis in interface LiveCacheStatisticsLiveCacheStatistics.getAverageGetTimeMillis()public long getAverageGetTimeNanos()
getAverageGetTimeNanos in interface LiveCacheStatisticsLiveCacheStatistics.getAverageGetTimeNanos()public long getCacheHitCount()
getCacheHitCount in interface LiveCacheStatisticsLiveCacheStatistics.getCacheHitCount()public long getCacheMissCount()
getCacheMissCount in interface LiveCacheStatisticsLiveCacheStatistics.getCacheMissCount()public long getInMemoryMissCount()
getInMemoryMissCount in interface LiveCacheStatisticsLiveCacheStatistics.getInMemoryMissCount()public long getOffHeapMissCount()
getOffHeapMissCount in interface LiveCacheStatisticsLiveCacheStatistics.getOffHeapMissCount()public long getOnDiskMissCount()
getOnDiskMissCount in interface LiveCacheStatisticsLiveCacheStatistics.getOnDiskMissCount()public long getCacheMissCountExpired()
getCacheMissCountExpired in interface LiveCacheStatisticsLiveCacheStatistics.getCacheMissCountExpired()public int getCacheHitRatio()
getCacheHitRatio in interface LiveCacheStatisticsLiveCacheStatistics.getCacheHitRatio()public long getEvictedCount()
getEvictedCount in interface LiveCacheStatisticsLiveCacheStatistics.getEvictedCount()public long getExpiredCount()
getExpiredCount in interface LiveCacheStatisticsLiveCacheStatistics.getExpiredCount()public long getInMemoryHitCount()
getInMemoryHitCount in interface LiveCacheStatisticsLiveCacheStatistics.getInMemoryHitCount()public long getOffHeapHitCount()
getOffHeapHitCount in interface LiveCacheStatisticsLiveCacheStatistics.getOffHeapHitCount()public long getOnDiskHitCount()
getOnDiskHitCount in interface LiveCacheStatisticsLiveCacheStatistics.getOnDiskHitCount()public long getPutCount()
getPutCount in interface LiveCacheStatisticsLiveCacheStatistics.getPutCount()public long getRemovedCount()
getRemovedCount in interface LiveCacheStatisticsLiveCacheStatistics.getRemovedCount()public long getUpdateCount()
getUpdateCount in interface LiveCacheStatisticsLiveCacheStatistics.getUpdateCount()public void addGetTimeMillis(long millis)
addGetTimeMillis in interface LiveCacheStatisticsDataLiveCacheStatisticsData.addGetTimeMillis(long)public void addGetTimeNanos(long nanos)
addGetTimeNanos in interface LiveCacheStatisticsDataLiveCacheStatisticsData.addGetTimeNanos(long)@Deprecated public long getMaxGetTimeMillis()
getMaxGetTimeMillis in interface LiveCacheStatisticsLiveCacheStatistics.getMaxGetTimeMillis()@Deprecated public long getMinGetTimeMillis()
getMinGetTimeMillis in interface LiveCacheStatisticsLiveCacheStatistics.getMinGetTimeMillis()public long getMaxGetTimeNanos()
getMaxGetTimeNanos in interface LiveCacheStatisticsLiveCacheStatistics.getMaxGetTimeNanos()public long getMinGetTimeNanos()
getMinGetTimeNanos in interface LiveCacheStatisticsLiveCacheStatistics.getMinGetTimeNanos()public long getXaCommitCount()
getXaCommitCount in interface LiveCacheStatisticsLiveCacheStatistics.getXaCommitCount()public long getXaRollbackCount()
getXaRollbackCount in interface LiveCacheStatisticsLiveCacheStatistics.getXaRollbackCount()public long getXaRecoveredCount()
getXaRecoveredCount in interface LiveCacheStatisticsLiveCacheStatistics.getXaRecoveredCount()public long getWriterQueueLength()
getWriterQueueLength in interface LiveCacheStatisticspublic void cacheHitInMemory()
cacheHitInMemory in interface LiveCacheStatisticsDataLiveCacheStatisticsData.cacheHitInMemory()public void cacheHitOffHeap()
cacheHitOffHeap in interface LiveCacheStatisticsDataLiveCacheStatisticsData.cacheHitOffHeap()public void cacheHitOnDisk()
cacheHitOnDisk in interface LiveCacheStatisticsDataLiveCacheStatisticsData.cacheHitOnDisk()public void cacheMissExpired()
cacheMissExpired in interface LiveCacheStatisticsDataLiveCacheStatisticsData.cacheMissExpired()public void xaCommit()
xaCommit in interface LiveCacheStatisticsDataLiveCacheStatisticsData.xaCommit()public void xaRollback()
xaRollback in interface LiveCacheStatisticsDataLiveCacheStatisticsData.xaRollback()public void xaRecovered(int count)
xaRecovered in interface LiveCacheStatisticsDataLiveCacheStatisticsData.xaRecovered(int)public void cacheMissNotFound()
cacheMissNotFound in interface LiveCacheStatisticsDataLiveCacheStatisticsData.cacheMissNotFound()public void cacheMissInMemory()
cacheMissInMemory in interface LiveCacheStatisticsDataLiveCacheStatisticsData.cacheMissNotFound()public void cacheMissOffHeap()
cacheMissOffHeap in interface LiveCacheStatisticsDataLiveCacheStatisticsData.cacheMissNotFound()public void cacheMissOnDisk()
cacheMissOnDisk in interface LiveCacheStatisticsDataLiveCacheStatisticsData.cacheMissNotFound()public void clearStatistics()
clearStatistics in interface LiveCacheStatisticsclearStatistics in interface LiveCacheStatisticsDataLiveCacheStatisticsData.clearStatistics()public void dispose()
dispose in interface CacheEventListenerCacheEventListener.dispose()
public void notifyElementEvicted(Ehcache cache,
Element element)
notifyElementEvicted in interface CacheEventListenercache - the cache emitting the notificationelement - the element that has just been evictedCacheEventListener.notifyElementEvicted(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
public void notifyElementExpired(Ehcache cache,
Element element)
Cache.remove(Object) method will block until this method returns.
As the Element has been expired, only what was the key of the element is known.
Elements are checked for expiry in ehcache at the following times:
Cache.DEFAULT_EXPIRY_THREAD_INTERVAL_SECONDS
notifyElementExpired in interface CacheEventListenercache - the cache emitting the notificationelement - the element that has just expired
Deadlock Warning: expiry will often come from the DiskStore
expiry thread. It holds a lock to the DiskStorea the time the
notification is sent. If the implementation of this method calls into a
synchronized Cache method and that subsequently calls into
DiskStore a deadlock will result. Accordingly implementers of this method
should not call back into Cache.CacheEventListener.notifyElementExpired(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
public void notifyElementPut(Ehcache cache,
Element element)
throws CacheException
Cache.put(net.sf.ehcache.Element) method
will block until this method returns.
Implementers may wish to have access to the Element's fields, including value, so the
element is provided. Implementers should be careful not to modify the element. The
effect of any modifications is undefined.
notifyElementPut in interface CacheEventListenercache - the cache emitting the notificationelement - the element which was just put into the cache.
CacheExceptionCacheEventListener.notifyElementPut(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
public void notifyElementRemoved(Ehcache cache,
Element element)
throws CacheException
CacheEventListener.notifyRemoveAll(net.sf.ehcache.Ehcache)
CacheEventListener.notifyElementEvicted(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
notifyElementRemoved in interface CacheEventListenercache - the cache emitting the notificationelement - the element just deleted, or a synthetic element with just the key set if
no element was removed.
CacheExceptionCacheEventListener.notifyElementRemoved(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
public void notifyElementUpdated(Ehcache cache,
Element element)
throws CacheException
Cache.put(net.sf.ehcache.Element) method
will block until this method returns.
Implementers may wish to have access to the Element's fields, including value, so the
element is provided. Implementers should be careful not to modify the element. The
effect of any modifications is undefined.
notifyElementUpdated in interface CacheEventListenercache - the cache emitting the notificationelement - the element which was just put into the cache.
CacheExceptionCacheEventListener.notifyElementUpdated(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)public void notifyRemoveAll(Ehcache cache)
Ehcache.removeAll() to indicate that the all
elements have been removed from the cache in a bulk operation. The usual
CacheEventListener.notifyElementRemoved(net.sf.ehcache.Ehcache, net.sf.ehcache.Element)
is not called.
This notification exists because clearing a cache is a special case. It is often
not practical to serially process notifications where potentially millions of elements
have been bulk deleted.
notifyRemoveAll in interface CacheEventListenercache - the cache emitting the notificationCacheEventListener.notifyRemoveAll(net.sf.ehcache.Ehcache)
public Object clone()
throws CloneNotSupportedException
clone in interface CacheEventListenerclone in class ObjectCloneNotSupportedException - if the listener could not be cloned.Object.clone()
|
ehcache | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||