|
ehcache | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.ehcache.statistics.LiveCacheStatisticsImpl
public class LiveCacheStatisticsImpl
Implementation which can be used both as a LiveCacheStatistics and LiveCacheStatisticsData
| Constructor Summary | |
|---|---|
LiveCacheStatisticsImpl(Ehcache cache)
Constructor that accepts the backing Ehcache, needed for getSize() |
|
| 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 |
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()
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()
Number of of bytes used by entries in the DiskStore |
long |
getLocalHeapSize()
Number of entries in the MemoryStore |
long |
getLocalHeapSizeInBytes()
Number of of bytes used by entries in the MemoryStore |
long |
getLocalOffHeapSize()
Number of entries in the off-heap store |
long |
getLocalOffHeapSizeInBytes()
Number of of bytes used by entries in the off-heap store |
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()
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 |
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 LiveCacheStatisticsImpl(Ehcache cache)
Ehcache, needed for getSize()
cache - | Method Detail |
|---|
public void clearStatistics()
clearStatistics in interface LiveCacheStatisticsclearStatistics in interface LiveCacheStatisticsDatapublic void xaCommit()
xaCommit in interface LiveCacheStatisticsDatapublic void xaRollback()
xaRollback in interface LiveCacheStatisticsDatapublic boolean isStatisticsEnabled()
isStatisticsEnabled in interface LiveCacheStatisticspublic void setStatisticsEnabled(boolean enableStatistics)
setStatisticsEnabled in interface LiveCacheStatisticsDatapublic void addGetTimeMillis(long millis)
addGetTimeMillis in interface LiveCacheStatisticsDatapublic void cacheHitInMemory()
cacheHitInMemory in interface LiveCacheStatisticsDatapublic void cacheHitOffHeap()
cacheHitOffHeap in interface LiveCacheStatisticsDatapublic void cacheHitOnDisk()
cacheHitOnDisk in interface LiveCacheStatisticsDatapublic void cacheMissExpired()
cacheMissExpired in interface LiveCacheStatisticsDatapublic void cacheMissNotFound()
cacheMissNotFound in interface LiveCacheStatisticsDatapublic void cacheMissInMemory()
cacheMissInMemory in interface LiveCacheStatisticsDatapublic void cacheMissOffHeap()
cacheMissOffHeap in interface LiveCacheStatisticsDatapublic void cacheMissOnDisk()
cacheMissOnDisk in interface LiveCacheStatisticsDatapublic void setStatisticsAccuracy(int statisticsAccuracy)
setStatisticsAccuracy in interface LiveCacheStatisticsDatastatisticsAccuracy - one of Statistics#STATISTICS_ACCURACY_BEST_EFFORT,
Statistics#STATISTICS_ACCURACY_GUARANTEED,
Statistics#STATISTICS_ACCURACY_NONEpublic void dispose()
dispose in interface CacheEventListener
public void notifyElementEvicted(Ehcache cache,
Element element)
notifyElementEvicted in interface CacheEventListenercache - the cache emitting the notificationelement - the element that has just been evicted
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.
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.
CacheException
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.
CacheException
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.
CacheExceptionpublic 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 notification
public Object clone()
throws CloneNotSupportedException
clone in interface CacheEventListenerclone in class ObjectCloneNotSupportedException - if the listener could not be cloned.public float getAverageGetTimeMillis()
getAverageGetTimeMillis in interface LiveCacheStatistics
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 LiveCacheStatisticsDataIllegalStateException
public void removeCacheUsageListener(CacheUsageListener cacheUsageListener)
throws IllegalStateException
CacheUsageListener, if any.
Depends on the Object.equals(Object) method.
removeCacheUsageListener in interface LiveCacheStatisticsDataIllegalStateExceptionpublic long getCacheHitCount()
getCacheHitCount in interface LiveCacheStatisticspublic long getCacheMissCount()
getCacheMissCount in interface LiveCacheStatisticspublic long getInMemoryMissCount()
getInMemoryMissCount in interface LiveCacheStatisticspublic long getOffHeapMissCount()
getOffHeapMissCount in interface LiveCacheStatisticspublic long getOnDiskMissCount()
getOnDiskMissCount in interface LiveCacheStatisticspublic long getCacheMissCountExpired()
getCacheMissCountExpired in interface LiveCacheStatisticspublic long getEvictedCount()
getEvictedCount in interface LiveCacheStatisticspublic long getInMemoryHitCount()
getInMemoryHitCount in interface LiveCacheStatisticspublic long getOffHeapHitCount()
getOffHeapHitCount in interface LiveCacheStatisticspublic long getOnDiskHitCount()
getOnDiskHitCount in interface LiveCacheStatisticspublic long getSize()
getSize in interface LiveCacheStatistics@Deprecated public long getInMemorySize()
getLocalHeapSize()
getInMemorySize in interface LiveCacheStatistics@Deprecated public long getOffHeapSize()
getLocalOffHeapSize()
getOffHeapSize in interface LiveCacheStatistics@Deprecated public long getOnDiskSize()
getLocalDiskSize()
getOnDiskSize in interface LiveCacheStatisticspublic long getLocalHeapSize()
getLocalHeapSize in interface LiveCacheStatisticspublic long getLocalOffHeapSize()
getLocalOffHeapSize in interface LiveCacheStatisticspublic long getLocalDiskSize()
getLocalDiskSize in interface LiveCacheStatisticspublic long getLocalDiskSizeInBytes()
getLocalDiskSizeInBytes in interface LiveCacheStatisticspublic long getLocalHeapSizeInBytes()
getLocalHeapSizeInBytes in interface LiveCacheStatisticspublic long getLocalOffHeapSizeInBytes()
getLocalOffHeapSizeInBytes in interface LiveCacheStatisticspublic String getCacheName()
getCacheName in interface LiveCacheStatisticspublic int getStatisticsAccuracy()
getStatisticsAccuracy in interface LiveCacheStatisticspublic long getExpiredCount()
getExpiredCount in interface LiveCacheStatisticspublic long getPutCount()
getPutCount in interface LiveCacheStatisticspublic long getRemovedCount()
getRemovedCount in interface LiveCacheStatisticspublic long getUpdateCount()
getUpdateCount in interface LiveCacheStatisticspublic String getStatisticsAccuracyDescription()
getStatisticsAccuracyDescription in interface LiveCacheStatisticspublic 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()
|
ehcache | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||