public class ConcurrentTileCacheMultiMap extends Observable implements TileCache, CacheDiagnostics
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.Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
ConcurrentTileCacheMultiMap() |
ConcurrentTileCacheMultiMap(long memoryCacheCapacity,
boolean diagnostic,
float mem_threshold,
int concurrencyLevel) |
Modifier and Type | Method and Description |
---|---|
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
|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
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
public ConcurrentTileCacheMultiMap()
public ConcurrentTileCacheMultiMap(long memoryCacheCapacity, boolean diagnostic, float mem_threshold, int concurrencyLevel)
public void add(RenderedImage owner, int tileX, int tileY, Raster data)
add
in interface TileCache
public void add(RenderedImage owner, int tileX, int tileY, Raster data, Object tileCacheMetric)
add
in interface TileCache
public void remove(RenderedImage owner, int tileX, int tileY)
remove
in interface TileCache
public Raster getTile(RenderedImage owner, int tileX, int tileY)
getTile
in interface TileCache
public Raster[] getTiles(RenderedImage owner)
null
if there were no tiles in the cache. The
array contains no null entries.getTiles
in interface TileCache
public void removeTiles(RenderedImage owner)
removeTiles
in interface TileCache
public void addTiles(RenderedImage owner, Point[] tileIndices, Raster[] tiles, Object tileCacheMetric)
addTiles
in interface TileCache
public Raster[] getTiles(RenderedImage owner, Point[] tileIndices)
null
if there were
not in the cache. The array contains null entries.getTiles
in interface TileCache
public void flush()
flush
in interface TileCache
public void memoryControl()
memoryControl
in interface TileCache
UnsupportedOperationException
public void setTileCapacity(int tileCapacity)
setTileCapacity
in interface TileCache
UnsupportedOperationException
public int getTileCapacity()
getTileCapacity
in interface TileCache
UnsupportedOperationException
public void setMemoryCapacity(long memoryCacheCapacity)
setMemoryCapacity
in interface TileCache
public long getMemoryCapacity()
getMemoryCapacity
in interface TileCache
public void setMemoryThreshold(float mt)
setMemoryThreshold
in interface TileCache
public float getMemoryThreshold()
getMemoryThreshold
in interface TileCache
public void setConcurrencyLevel(int concurrency)
public int getConcurrencyLevel()
public void setTileComparator(Comparator comparator)
setTileComparator
in interface TileCache
UnsupportedOperationException
public Comparator getTileComparator()
getTileComparator
in interface TileCache
UnsupportedOperationException
public void disableDiagnostics()
disableDiagnostics
in interface CacheDiagnostics
public void enableDiagnostics()
enableDiagnostics
in interface CacheDiagnostics
public long getCacheHitCount()
getCacheHitCount
in interface CacheDiagnostics
public long getCacheMemoryUsed()
getCacheMemoryUsed
in interface CacheDiagnostics
public long getCacheMissCount()
getCacheMissCount
in interface CacheDiagnostics
public long getCacheTileCount()
getCacheTileCount
in interface CacheDiagnostics
public void resetCounts()
resetCounts
in interface CacheDiagnostics
UnsupportedOperationException
Copyright © 2006–2018 GeoSolutions. All rights reserved.