Class ImageCacheStatistics
- java.lang.Object
-
- org.apache.xmlgraphics.image.loader.cache.ImageCacheStatistics
-
- All Implemented Interfaces:
java.util.EventListener
,ImageCacheListener
public class ImageCacheStatistics extends java.lang.Object implements ImageCacheListener
Convenience class that gathers statistical information about the image cache.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map
imageCacheHitMap
private int
imageCacheHits
private int
imageCacheMisses
private java.util.Map
imageCacheMissMap
private int
imageInfoCacheHits
private int
imageInfoCacheMisses
private int
invalidHits
-
Constructor Summary
Constructors Constructor Description ImageCacheStatistics(boolean detailed)
Main constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cacheHitImage(ImageKey key)
An Image was found in the cachevoid
cacheHitImageInfo(java.lang.String uri)
An ImageInfo was found in the cachevoid
cacheMissImage(ImageKey key)
An Image was not in the cachevoid
cacheMissImageInfo(java.lang.String uri)
An ImageInfo was not in the cachejava.util.Map
getImageCacheHitMap()
Returns a Map<ImageKey, Integer> with the number of cache hits.int
getImageCacheHits()
Returns the number of cache hits for Image instances.int
getImageCacheMisses()
Returns the number of cache misses for Image instances.java.util.Map
getImageCacheMissMap()
Returns a Map<ImageKey, Integer> with the number of cache misses.int
getImageInfoCacheHits()
Returns the number of cache hits for ImageInfo instances.int
getImageInfoCacheMisses()
Returns the number of cache misses for ImageInfo instances.int
getInvalidHits()
Returns the number of times an invalid URI is tried.private void
increaseEntry(java.util.Map map, java.lang.Object key)
void
invalidHit(java.lang.String uri)
An URi previously identified as invalid was requested againvoid
reset()
Reset the gathered statistics information.
-
-
-
Field Detail
-
invalidHits
private int invalidHits
-
imageInfoCacheHits
private int imageInfoCacheHits
-
imageInfoCacheMisses
private int imageInfoCacheMisses
-
imageCacheHits
private int imageCacheHits
-
imageCacheMisses
private int imageCacheMisses
-
imageCacheHitMap
private java.util.Map imageCacheHitMap
-
imageCacheMissMap
private java.util.Map imageCacheMissMap
-
-
Method Detail
-
reset
public void reset()
Reset the gathered statistics information.
-
invalidHit
public void invalidHit(java.lang.String uri)
An URi previously identified as invalid was requested again- Specified by:
invalidHit
in interfaceImageCacheListener
- Parameters:
uri
- the invalid URI
-
cacheHitImageInfo
public void cacheHitImageInfo(java.lang.String uri)
An ImageInfo was found in the cache- Specified by:
cacheHitImageInfo
in interfaceImageCacheListener
- Parameters:
uri
- the image's URI
-
cacheMissImageInfo
public void cacheMissImageInfo(java.lang.String uri)
An ImageInfo was not in the cache- Specified by:
cacheMissImageInfo
in interfaceImageCacheListener
- Parameters:
uri
- the image's URI
-
increaseEntry
private void increaseEntry(java.util.Map map, java.lang.Object key)
-
cacheHitImage
public void cacheHitImage(ImageKey key)
An Image was found in the cache- Specified by:
cacheHitImage
in interfaceImageCacheListener
- Parameters:
key
- the image key
-
cacheMissImage
public void cacheMissImage(ImageKey key)
An Image was not in the cache- Specified by:
cacheMissImage
in interfaceImageCacheListener
- Parameters:
key
- the image key
-
getInvalidHits
public int getInvalidHits()
Returns the number of times an invalid URI is tried.- Returns:
- the number of times an invalid URI is tried.
-
getImageInfoCacheHits
public int getImageInfoCacheHits()
Returns the number of cache hits for ImageInfo instances.- Returns:
- the number of cache hits for ImageInfo instances.
-
getImageInfoCacheMisses
public int getImageInfoCacheMisses()
Returns the number of cache misses for ImageInfo instances.- Returns:
- the number of cache misses for ImageInfo instances.
-
getImageCacheHits
public int getImageCacheHits()
Returns the number of cache hits for Image instances.- Returns:
- the number of cache hits for Image instances.
-
getImageCacheMisses
public int getImageCacheMisses()
Returns the number of cache misses for Image instances.- Returns:
- the number of cache misses for Image instances.
-
getImageCacheHitMap
public java.util.Map getImageCacheHitMap()
Returns a Map<ImageKey, Integer> with the number of cache hits.- Returns:
- a Map<ImageKey, Integer> with the number of cache hits
-
getImageCacheMissMap
public java.util.Map getImageCacheMissMap()
Returns a Map<ImageKey, Integer> with the number of cache misses.- Returns:
- a Map<ImageKey, Integer> with the number of cache misses
-
-