Changeset 8397 in josm for trunk/src/org/openstreetmap/josm/data/cache
- Timestamp:
- 2015-05-19T20:54:26+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
r8389 r8397 63 63 64 64 public static class LIFOQueue extends LinkedBlockingDeque<Runnable> { 65 public LIFOQueue() { 66 super(); 67 } 68 65 69 public LIFOQueue(int capacity) { 66 70 super(capacity); … … 91 95 * and performance (we do want to have something to offer to worker threads before tasks will be resubmitted by class consumer) 92 96 */ 93 private static Executor D OWNLOAD_JOB_DISPATCHER = new ThreadPoolExecutor(97 private static Executor DEFAULT_DOWNLOAD_JOB_DISPATCHER = new ThreadPoolExecutor( 94 98 2, // we have a small queue, so threads will be quickly started (threads are started only, when queue is full) 95 99 THREAD_LIMIT.get().intValue(), // do not this number of threads … … 114 118 private int readTimeout; 115 119 private Map<String, String> headers; 120 private Executor downloadJobExecutor; 116 121 117 122 /** … … 120 125 * @param readTimeout 121 126 * @param connectTimeout 127 * @param downloadJobExecutor 122 128 */ 123 129 public JCSCachedTileLoaderJob(ICacheAccess<K,V> cache, 124 130 int connectTimeout, int readTimeout, 125 Map<String, String> headers) { 131 Map<String, String> headers, 132 Executor downloadJobExecutor) { 126 133 127 134 this.cache = cache; … … 130 137 this.readTimeout = readTimeout; 131 138 this.headers = headers; 139 this.downloadJobExecutor = downloadJobExecutor; 140 } 141 142 /** 143 * @param cache cache instance that we will work on 144 * @param headers 145 * @param readTimeout 146 * @param connectTimeout 147 */ 148 public JCSCachedTileLoaderJob(ICacheAccess<K, V> cache, 149 int connectTimeout, int readTimeout, 150 Map<String, String> headers) { 151 this(cache, connectTimeout, readTimeout, 152 headers, DEFAULT_DOWNLOAD_JOB_DISPATCHER); 132 153 } 133 154 … … 240 261 */ 241 262 protected Executor getDownloadExecutor() { 242 return DOWNLOAD_JOB_DISPATCHER; 243 } 244 263 return downloadJobExecutor; 264 } 245 265 246 266 public void run() { … … 330 350 return true; 331 351 } 352 332 353 HttpURLConnection urlConn = getURLConnection(); 333 354
Note:
See TracChangeset
for help on using the changeset viewer.