|
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 |
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 |
java.lang.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 milli seconds taken to get an element from the cache. |
long |
getCacheHitCount()
The number of times a requested item was found in the cache. |
long |
getCacheMissCount()
|
long |
getCacheMissCountExpired()
|
java.lang.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()
Number of elements in the MemoryStore |
long |
getMaxGetTimeMillis()
Return maximum time taken for a get operation in the cache in milliseconds |
long |
getMinGetTimeMillis()
Return minimum time taken for a get operation in the cache in milliseconds |
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()
Number of elements in the off-heap store |
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()
Number of elements in the DiskStore |
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. |
java.lang.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 |
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 |
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 java.lang.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 LiveCacheStatisticsDatajava.lang.IllegalStateExceptionLiveCacheStatisticsData.registerCacheUsageListener(net.sf.ehcache.statistics.CacheUsageListener)
public void removeCacheUsageListener(CacheUsageListener cacheUsageListener)
throws java.lang.IllegalStateException
CacheUsageListener, if any.
Depends on the Object.equals(Object) method.
removeCacheUsageListener in interface LiveCacheStatisticsDatajava.lang.IllegalStateExceptionLiveCacheStatisticsData.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 java.lang.String getStatisticsAccuracyDescription()
getStatisticsAccuracyDescription in interface LiveCacheStatisticsLiveCacheStatistics.getStatisticsAccuracyDescription()public java.lang.String getCacheName()
getCacheName in interface LiveCacheStatisticsLiveCacheStatistics.getCacheName()public long getSize()
getSize in interface LiveCacheStatisticsLiveCacheStatistics.getSize()public long getInMemorySize()
getInMemorySize in interface LiveCacheStatisticsLiveCacheStatistics.getInMemorySize()public long getOffHeapSize()
getOffHeapSize in interface LiveCacheStatisticsLiveCacheStatistics.getOffHeapSize()public long getOnDiskSize()
getOnDiskSize in interface LiveCacheStatisticsLiveCacheStatistics.getOnDiskSize()public float getAverageGetTimeMillis()
getAverageGetTimeMillis in interface LiveCacheStatisticsLiveCacheStatistics.getAverageGetTimeMillis()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 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 long getMaxGetTimeMillis()
getMaxGetTimeMillis in interface LiveCacheStatisticsLiveCacheStatistics.getMaxGetTimeMillis()public long getXaCommitCount()
getXaCommitCount in interface LiveCacheStatisticsLiveCacheStatistics.getXaCommitCount()public long getXaRollbackCount()
getXaRollbackCount in interface LiveCacheStatisticsLiveCacheStatistics.getXaRollbackCount()public long getWriterQueueLength()
getWriterQueueLength in interface LiveCacheStatisticspublic long getMinGetTimeMillis()
getMinGetTimeMillis in interface LiveCacheStatisticsLiveCacheStatistics.getMinGetTimeMillis()public 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 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 java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface CacheEventListenerclone in class java.lang.Objectjava.lang.CloneNotSupportedException - 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 | |||||||||