|
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 |
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()
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 |
getMaxGetTimeNanos()
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 |
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 LiveCacheStatisticsImpl(Ehcache cache)
Ehcache
, needed for getSize()
cache
- Method Detail |
---|
public void clearStatistics()
clearStatistics
in interface LiveCacheStatistics
clearStatistics
in interface LiveCacheStatisticsData
public void xaCommit()
xaCommit
in interface LiveCacheStatisticsData
public void xaRollback()
xaRollback
in interface LiveCacheStatisticsData
public void xaRecovered(int count)
xaRecovered
in interface LiveCacheStatisticsData
public boolean isStatisticsEnabled()
isStatisticsEnabled
in interface LiveCacheStatistics
public void setStatisticsEnabled(boolean enableStatistics)
setStatisticsEnabled
in interface LiveCacheStatisticsData
public void addGetTimeNanos(long nanos)
addGetTimeNanos
in interface LiveCacheStatisticsData
public void addGetTimeMillis(long millis)
addGetTimeMillis
in interface LiveCacheStatisticsData
public void cacheHitInMemory()
cacheHitInMemory
in interface LiveCacheStatisticsData
public void cacheHitOffHeap()
cacheHitOffHeap
in interface LiveCacheStatisticsData
public void cacheHitOnDisk()
cacheHitOnDisk
in interface LiveCacheStatisticsData
public void cacheMissExpired()
cacheMissExpired
in interface LiveCacheStatisticsData
public void cacheMissNotFound()
cacheMissNotFound
in interface LiveCacheStatisticsData
public void cacheMissInMemory()
cacheMissInMemory
in interface LiveCacheStatisticsData
public void cacheMissOffHeap()
cacheMissOffHeap
in interface LiveCacheStatisticsData
public void cacheMissOnDisk()
cacheMissOnDisk
in interface LiveCacheStatisticsData
public void setStatisticsAccuracy(int statisticsAccuracy)
setStatisticsAccuracy
in interface LiveCacheStatisticsData
statisticsAccuracy
- 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 CacheEventListener
cache
- the cache emitting the notificationelement
- the element that has just been evictedpublic 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 CacheEventListener
cache
- 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 CacheEventListener
cache
- 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 CacheEventListener
cache
- 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 CacheEventListener
cache
- the cache emitting the notificationelement
- the element which was just put into the cache.
CacheException
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 CacheEventListener
cache
- the cache emitting the notificationpublic Object clone() throws CloneNotSupportedException
clone
in interface CacheEventListener
clone
in class Object
CloneNotSupportedException
- if the listener could not be cloned.public float getAverageGetTimeMillis()
getAverageGetTimeMillis
in interface LiveCacheStatistics
public long getAverageGetTimeNanos()
getAverageGetTimeNanos
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 LiveCacheStatisticsData
IllegalStateException
public void removeCacheUsageListener(CacheUsageListener cacheUsageListener) throws IllegalStateException
CacheUsageListener
, if any.
Depends on the Object.equals(Object)
method.
removeCacheUsageListener
in interface LiveCacheStatisticsData
IllegalStateException
public long getCacheHitCount()
getCacheHitCount
in interface LiveCacheStatistics
public long getCacheMissCount()
getCacheMissCount
in interface LiveCacheStatistics
public long getInMemoryMissCount()
getInMemoryMissCount
in interface LiveCacheStatistics
public long getOffHeapMissCount()
getOffHeapMissCount
in interface LiveCacheStatistics
public long getOnDiskMissCount()
getOnDiskMissCount
in interface LiveCacheStatistics
public long getCacheMissCountExpired()
getCacheMissCountExpired
in interface LiveCacheStatistics
public int getCacheHitRatio()
getCacheHitRatio
in interface LiveCacheStatistics
public long getEvictedCount()
getEvictedCount
in interface LiveCacheStatistics
public long getInMemoryHitCount()
getInMemoryHitCount
in interface LiveCacheStatistics
public long getOffHeapHitCount()
getOffHeapHitCount
in interface LiveCacheStatistics
public long getOnDiskHitCount()
getOnDiskHitCount
in interface LiveCacheStatistics
public 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 LiveCacheStatistics
public long getLocalHeapSize()
getLocalHeapSize
in interface LiveCacheStatistics
public long getLocalOffHeapSize()
getLocalOffHeapSize
in interface LiveCacheStatistics
public long getLocalDiskSize()
getLocalDiskSize
in interface LiveCacheStatistics
public long getLocalDiskSizeInBytes()
getLocalDiskSizeInBytes
in interface LiveCacheStatistics
public long getLocalHeapSizeInBytes()
getLocalHeapSizeInBytes
in interface LiveCacheStatistics
public long getLocalOffHeapSizeInBytes()
getLocalOffHeapSizeInBytes
in interface LiveCacheStatistics
public String getCacheName()
getCacheName
in interface LiveCacheStatistics
public int getStatisticsAccuracy()
getStatisticsAccuracy
in interface LiveCacheStatistics
public long getExpiredCount()
getExpiredCount
in interface LiveCacheStatistics
public long getPutCount()
getPutCount
in interface LiveCacheStatistics
public long getRemovedCount()
getRemovedCount
in interface LiveCacheStatistics
public long getUpdateCount()
getUpdateCount
in interface LiveCacheStatistics
public String getStatisticsAccuracyDescription()
getStatisticsAccuracyDescription
in interface LiveCacheStatistics
public long getMaxGetTimeMillis()
getMaxGetTimeMillis
in interface LiveCacheStatistics
LiveCacheStatistics.getMaxGetTimeMillis()
public long getMinGetTimeMillis()
getMinGetTimeMillis
in interface LiveCacheStatistics
LiveCacheStatistics.getMinGetTimeMillis()
public long getMaxGetTimeNanos()
getMaxGetTimeNanos
in interface LiveCacheStatistics
LiveCacheStatistics.getMaxGetTimeNanos()
public long getMinGetTimeNanos()
getMinGetTimeNanos
in interface LiveCacheStatistics
LiveCacheStatistics.getMinGetTimeNanos()
public long getXaCommitCount()
getXaCommitCount
in interface LiveCacheStatistics
LiveCacheStatistics.getXaCommitCount()
public long getXaRollbackCount()
getXaRollbackCount
in interface LiveCacheStatistics
LiveCacheStatistics.getXaRollbackCount()
public long getXaRecoveredCount()
getXaRecoveredCount
in interface LiveCacheStatistics
LiveCacheStatistics.getXaRecoveredCount()
public long getWriterQueueLength()
getWriterQueueLength
in interface LiveCacheStatistics
|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |