|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
it.geosolutions.concurrent.ConcurrentTileCacheMultiMap
public class ConcurrentTileCacheMultiMap
This implementation of the TileCache class uses a Guava Cache and a multimap in order to provide a better concurrency handling. The first object
contains all the cached tiles while the second one contains the mapping of the tile keys for each image. This class implements
CacheDiagnostics
in order to get the statistics associated to the TileCache
. The user can define the cache memory capacity, the
concurrency level (which indicates in how many segments the cache must be divided), the threshold of the total memory to use and a boolean
indicating if the diagnostic must be enabled.
Field Summary | |
---|---|
static int |
DEFAULT_CONCURRENCY_LEVEL
The default concurrency settings |
static boolean |
DEFAULT_DIAGNOSTIC
The default diagnostic settings |
static long |
DEFAULT_MEMORY_CACHE
The default memory capacity of the cache (16 MB). |
static float |
DEFAULT_MEMORY_THRESHOLD
The default memory threshold of the cache. |
Constructor Summary | |
---|---|
ConcurrentTileCacheMultiMap()
|
|
ConcurrentTileCacheMultiMap(long memoryCacheCapacity,
boolean diagnostic,
float mem_threshold,
int concurrencyLevel)
|
Method Summary | |
---|---|
void |
add(RenderedImage owner,
int tileX,
int tileY,
Raster data)
Add a new tile to the cache |
void |
add(RenderedImage owner,
int tileX,
int tileY,
Raster data,
Object tileCacheMetric)
Add a new tile to the cache |
void |
addTiles(RenderedImage owner,
Point[] tileIndices,
Raster[] tiles,
Object tileCacheMetric)
Adds all tiles in the Point array which are owned by the image. |
void |
disableDiagnostics()
Disables diagnosticEnabled for the observers |
void |
enableDiagnostics()
Enables diagnosticEnabled for the observers |
void |
flush()
Removes all tiles present in the cache without checking for the image owner |
long |
getCacheHitCount()
Retrieves the hit count from the cache statistics |
long |
getCacheMemoryUsed()
Retrieves the current memory size of the cache |
long |
getCacheMissCount()
Retrieves the miss count from the cache statistics |
long |
getCacheTileCount()
Retrieves the number of tiles in the cache |
int |
getConcurrencyLevel()
Retrieve the cache concurrency level |
long |
getMemoryCapacity()
Retrieve the cache memory capacity |
float |
getMemoryThreshold()
Retrieve the cache memory threshold |
Raster |
getTile(RenderedImage owner,
int tileX,
int tileY)
Retrieves the selected tile from the cache |
int |
getTileCapacity()
Not Supported |
Comparator |
getTileComparator()
Not Supported |
Raster[] |
getTiles(RenderedImage owner)
Retrieves an array of all tiles in the cache which are owned by the image. |
Raster[] |
getTiles(RenderedImage owner,
Point[] tileIndices)
Retrieves an array of tiles in the cache which are specified by the Point array and owned by the image. |
void |
memoryControl()
Not Supported |
void |
remove(RenderedImage owner,
int tileX,
int tileY)
Removes the selected tile from the cache |
void |
removeTiles(RenderedImage owner)
Removes all tiles in the cache which are owned by the image. |
void |
resetCounts()
Not Supported |
void |
setConcurrencyLevel(int concurrency)
Sets the cache ConcurrencyLevel and then flush and rebuild the cache |
void |
setMemoryCapacity(long memoryCacheCapacity)
Sets the cache memory capacity and then flush and rebuild the cache |
void |
setMemoryThreshold(float mt)
Sets the cache memory threshold and then flush and rebuild the cache |
void |
setTileCapacity(int tileCapacity)
Not Supported |
void |
setTileComparator(Comparator comparator)
Not Supported |
Methods inherited from class java.util.Observable |
---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final float DEFAULT_MEMORY_THRESHOLD
public static final long DEFAULT_MEMORY_CACHE
public static final boolean DEFAULT_DIAGNOSTIC
public static final int DEFAULT_CONCURRENCY_LEVEL
Constructor Detail |
---|
public ConcurrentTileCacheMultiMap()
public ConcurrentTileCacheMultiMap(long memoryCacheCapacity, boolean diagnostic, float mem_threshold, int concurrencyLevel)
Method Detail |
---|
public void add(RenderedImage owner, int tileX, int tileY, Raster data)
add
in interface javax.media.jai.TileCache
public void add(RenderedImage owner, int tileX, int tileY, Raster data, Object tileCacheMetric)
add
in interface javax.media.jai.TileCache
public void remove(RenderedImage owner, int tileX, int tileY)
remove
in interface javax.media.jai.TileCache
public Raster getTile(RenderedImage owner, int tileX, int tileY)
getTile
in interface javax.media.jai.TileCache
public Raster[] getTiles(RenderedImage owner)
null
if there were no tiles in the cache. The
array contains no null entries.
getTiles
in interface javax.media.jai.TileCache
public void removeTiles(RenderedImage owner)
removeTiles
in interface javax.media.jai.TileCache
public void addTiles(RenderedImage owner, Point[] tileIndices, Raster[] tiles, Object tileCacheMetric)
addTiles
in interface javax.media.jai.TileCache
public Raster[] getTiles(RenderedImage owner, Point[] tileIndices)
null
if there were
not in the cache. The array contains null entries.
getTiles
in interface javax.media.jai.TileCache
public void flush()
flush
in interface javax.media.jai.TileCache
public void memoryControl()
memoryControl
in interface javax.media.jai.TileCache
UnsupportedOperationException
public void setTileCapacity(int tileCapacity)
setTileCapacity
in interface javax.media.jai.TileCache
UnsupportedOperationException
public int getTileCapacity()
getTileCapacity
in interface javax.media.jai.TileCache
UnsupportedOperationException
public void setMemoryCapacity(long memoryCacheCapacity)
setMemoryCapacity
in interface javax.media.jai.TileCache
public long getMemoryCapacity()
getMemoryCapacity
in interface javax.media.jai.TileCache
public void setMemoryThreshold(float mt)
setMemoryThreshold
in interface javax.media.jai.TileCache
public float getMemoryThreshold()
getMemoryThreshold
in interface javax.media.jai.TileCache
public void setConcurrencyLevel(int concurrency)
public int getConcurrencyLevel()
public void setTileComparator(Comparator comparator)
setTileComparator
in interface javax.media.jai.TileCache
UnsupportedOperationException
public Comparator getTileComparator()
getTileComparator
in interface javax.media.jai.TileCache
UnsupportedOperationException
public void disableDiagnostics()
disableDiagnostics
in interface com.sun.media.jai.util.CacheDiagnostics
public void enableDiagnostics()
enableDiagnostics
in interface com.sun.media.jai.util.CacheDiagnostics
public long getCacheHitCount()
getCacheHitCount
in interface com.sun.media.jai.util.CacheDiagnostics
public long getCacheMemoryUsed()
getCacheMemoryUsed
in interface com.sun.media.jai.util.CacheDiagnostics
public long getCacheMissCount()
getCacheMissCount
in interface com.sun.media.jai.util.CacheDiagnostics
public long getCacheTileCount()
getCacheTileCount
in interface com.sun.media.jai.util.CacheDiagnostics
public void resetCounts()
resetCounts
in interface com.sun.media.jai.util.CacheDiagnostics
UnsupportedOperationException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |