public class OsmTileLoader extends java.lang.Object implements TileLoader
TileLoader
implementation that loads tiles from OSM.Modifier and Type | Class and Description |
---|---|
private class |
OsmTileLoader.OsmTileJob |
Modifier and Type | Field and Description |
---|---|
private static int |
DEFAULT_THREADS_NUMBER |
java.util.Map<java.lang.String,java.lang.String> |
headers
Holds the HTTP headers.
|
private static java.util.concurrent.ThreadPoolExecutor |
jobDispatcher |
protected TileLoaderListener |
listener |
private static java.util.logging.Logger |
LOG |
private static int |
nThreads |
static java.lang.String |
THREADS_SETTING
Setting key for number of threads
|
int |
timeoutConnect |
int |
timeoutRead |
Constructor and Description |
---|
OsmTileLoader(TileLoaderListener listener)
Constructs a new
OsmTileLoader . |
OsmTileLoader(TileLoaderListener listener,
java.util.Map<java.lang.String,java.lang.String> headers) |
Modifier and Type | Method and Description |
---|---|
void |
cancelOutstandingTasks()
cancels all outstanding tasks in the queue.
|
TileJob |
createTileLoaderJob(Tile tile)
A typical implementation of this function should create and return a
new
TileJob instance that performs the load action. |
boolean |
hasOutstandingTasks()
Determines whether this
TileLoader has tasks which have not completed. |
protected java.net.URLConnection |
loadTileFromOsm(Tile tile) |
protected void |
loadTileMetadata(Tile tile,
java.net.URLConnection urlConn) |
protected void |
prepareHttpUrlConnection(java.net.HttpURLConnection urlConn) |
static void |
setConcurrentConnections(int num)
Sets the maximum number of concurrent connections the tile loader will do
|
java.lang.String |
toString() |
private static final java.util.logging.Logger LOG
public static final java.lang.String THREADS_SETTING
private static final int DEFAULT_THREADS_NUMBER
private static int nThreads
private static final java.util.concurrent.ThreadPoolExecutor jobDispatcher
public java.util.Map<java.lang.String,java.lang.String> headers
public int timeoutConnect
public int timeoutRead
protected TileLoaderListener listener
public OsmTileLoader(TileLoaderListener listener)
OsmTileLoader
.listener
- tile loader listenerpublic OsmTileLoader(TileLoaderListener listener, java.util.Map<java.lang.String,java.lang.String> headers)
public 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.protected java.net.URLConnection loadTileFromOsm(Tile tile) throws java.io.IOException
java.io.IOException
protected void loadTileMetadata(Tile tile, java.net.URLConnection urlConn)
protected void prepareHttpUrlConnection(java.net.HttpURLConnection urlConn)
public java.lang.String toString()
toString
in class java.lang.Object
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 cancelOutstandingTasks()
TileLoader
cancelOutstandingTasks
in interface TileLoader
public static void setConcurrentConnections(int num)
num
- number of concurrent connections