public class TMSCachedTileLoader extends java.lang.Object implements TileLoader, CachedTileLoader
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.jcs.access.behavior.ICacheAccess<java.lang.String,BufferedImageCacheEntry> |
cache |
private static java.util.concurrent.ThreadPoolExecutor |
DEFAULT_DOWNLOAD_JOB_DISPATCHER
separate from JCS thread pool for TMS loader, so we can have different thread pools for default JCS
and for TMS imagery
|
private java.util.concurrent.ThreadPoolExecutor |
downloadExecutor |
static IntegerProperty |
HOST_LIMIT
Limit definition for per host concurrent connections
|
protected TileLoaderListener |
listener |
protected TileJobOptions |
options |
static IntegerProperty |
THREAD_LIMIT
overrides the THREAD_LIMIT in superclass, as we want to have separate limit and pool for TMS
|
Constructor and Description |
---|
TMSCachedTileLoader(TileLoaderListener listener,
org.apache.commons.jcs.access.behavior.ICacheAccess<java.lang.String,BufferedImageCacheEntry> cache,
TileJobOptions options)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
cancelOutstandingTasks()
cancels all outstanding tasks in the queue.
|
void |
clearCache(TileSource source) |
TileJob |
createTileLoaderJob(Tile tile)
A typical implementation of this function should create and return a
new
TileJob instance that performs the load action. |
java.util.concurrent.ThreadPoolExecutor |
getDownloadExecutor() |
static java.util.concurrent.ThreadPoolExecutor |
getNewThreadPoolExecutor(java.lang.String name) |
static java.util.concurrent.ThreadPoolExecutor |
getNewThreadPoolExecutor(java.lang.String nameFormat,
int workers) |
java.lang.String |
getStats() |
boolean |
hasOutstandingTasks()
Determines whether this
TileLoader has tasks which have not completed. |
void |
setDownloadExecutor(java.util.concurrent.ThreadPoolExecutor downloadExecutor)
Sets the download executor that will be used to download tiles instead of default one.
|
protected final org.apache.commons.jcs.access.behavior.ICacheAccess<java.lang.String,BufferedImageCacheEntry> cache
protected final TileLoaderListener listener
public static final IntegerProperty THREAD_LIMIT
public static final IntegerProperty HOST_LIMIT
private static final java.util.concurrent.ThreadPoolExecutor DEFAULT_DOWNLOAD_JOB_DISPATCHER
private java.util.concurrent.ThreadPoolExecutor downloadExecutor
protected final TileJobOptions options
public TMSCachedTileLoader(TileLoaderListener listener, org.apache.commons.jcs.access.behavior.ICacheAccess<java.lang.String,BufferedImageCacheEntry> cache, TileJobOptions options)
listener
- called when tile loading has finishedcache
- of the cacheoptions
- tile job optionspublic static java.util.concurrent.ThreadPoolExecutor getNewThreadPoolExecutor(java.lang.String nameFormat, int workers)
nameFormat
- see Utils.newThreadFactory(String, int)
workers
- number of worker thread to keeppublic static java.util.concurrent.ThreadPoolExecutor getNewThreadPoolExecutor(java.lang.String name)
name
- name of threadspublic TileJob createTileLoaderJob(Tile tile)
TileLoader
TileJob
instance that performs the load action.createTileLoaderJob
in interface TileLoader
tile
- the tile to be loadedTileJob
implementation that performs the desired load
action.public void clearCache(TileSource source)
clearCache
in interface CachedTileLoader
public java.lang.String getStats()
public void cancelOutstandingTasks()
cancelOutstandingTasks
in interface TileLoader
public boolean hasOutstandingTasks()
TileLoader
TileLoader
has tasks which have not completed.hasOutstandingTasks
in interface TileLoader
TileLoader
has tasks which have not completed. This answer may well be
"approximate" given that many implementations will be using mechanisms where a queue's state can change
during the computation.public void setDownloadExecutor(java.util.concurrent.ThreadPoolExecutor downloadExecutor)
getNewThreadPoolExecutor(java.lang.String, int)
to create a new download executor with separate
queue from default.downloadExecutor
- download executor that will be used to download tilespublic java.util.concurrent.ThreadPoolExecutor getDownloadExecutor()