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 |
protected int |
connectTimeout |
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 |
protected java.util.Map<java.lang.String,java.lang.String> |
headers |
static IntegerProperty |
HOST_LIMIT
Limit definition for per host concurrent connections
|
protected TileLoaderListener |
listener |
protected int |
readTimeout |
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,
int connectTimeout,
int readTimeout,
java.util.Map<java.lang.String,java.lang.String> headers)
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() |
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 int connectTimeout
protected final int readTimeout
protected final java.util.Map<java.lang.String,java.lang.String> headers
protected final TileLoaderListener listener
public static final IntegerProperty THREAD_LIMIT
public static final IntegerProperty HOST_LIMIT
private static java.util.concurrent.ThreadPoolExecutor DEFAULT_DOWNLOAD_JOB_DISPATCHER
private java.util.concurrent.ThreadPoolExecutor downloadExecutor
public TMSCachedTileLoader(TileLoaderListener listener, org.apache.commons.jcs.access.behavior.ICacheAccess<java.lang.String,BufferedImageCacheEntry> cache, int connectTimeout, int readTimeout, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException
listener - called when tile loading has finishedcache - of the cacheconnectTimeout - to remote resourcereadTimeout - to remote resourceheaders - HTTP headers to be sent along with requestjava.io.IOException - when cache initialization failspublic 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)
TileLoaderTileJob instance that performs the load action.createTileLoaderJob in interface TileLoadertile - the tile to be loadedTileJob implementation that performs the desired load
action.public void clearCache(TileSource source)
clearCache in interface CachedTileLoaderpublic java.lang.String getStats()
public void cancelOutstandingTasks()
cancelOutstandingTasks in interface TileLoaderpublic 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()