Changeset 15525 in josm
- Timestamp:
- 2019-11-17T18:37:18+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/cache/HostLimitQueue.java
r14261 r15525 130 130 Semaphore limit = hostSemaphores.get(host); 131 131 if (limit == null) { 132 synchronized (hostSemaphores) { 133 limit = hostSemaphores.computeIfAbsent(host, k -> new Semaphore(hostLimit)); 134 } 132 limit = hostSemaphores.computeIfAbsent(host, k -> new Semaphore(hostLimit)); 135 133 } 136 134 return limit; -
trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
r14535 r15525 153 153 throw new IllegalArgumentException("No url returned"); 154 154 } 155 synchronized (inProgress) { 156 Set<ICachedLoaderListener> newListeners = inProgress.get(deduplicationKey); 157 if (newListeners == null) { 158 newListeners = new HashSet<>(); 159 inProgress.put(deduplicationKey, newListeners); 160 first = true; 161 } 162 newListeners.add(listener); 163 } 155 synchronized (this) { 156 first = !inProgress.containsKey(deduplicationKey); 157 } 158 inProgress.computeIfAbsent(deduplicationKey, k -> new HashSet<>()).add(listener); 164 159 165 160 if (first || force) { … … 250 245 private void finishLoading(LoadResult result) { 251 246 Set<ICachedLoaderListener> listeners; 252 synchronized (inProgress) { 253 try { 254 listeners = inProgress.remove(getUrl().toString()); 255 } catch (IOException e) { 256 listeners = null; 257 Logging.trace(e); 258 } 247 try { 248 listeners = inProgress.remove(getUrl().toString()); 249 } catch (IOException e) { 250 listeners = null; 251 Logging.trace(e); 259 252 } 260 253 if (listeners == null) { -
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r14573 r15525 76 76 this.options = options; 77 77 if (listener != null) { 78 String deduplicationKey = getCacheKey(); 79 synchronized (inProgress) { 80 inProgress.computeIfAbsent(deduplicationKey, k -> new HashSet<>()).add(listener); 81 } 78 inProgress.computeIfAbsent(getCacheKey(), k -> new HashSet<>()).add(listener); 82 79 } 83 80 } … … 162 159 public void loadingFinished(CacheEntry object, CacheEntryAttributes attributes, LoadResult result) { 163 160 this.attributes = attributes; // as we might get notification from other object than our selfs, pass attributes along 164 Set<TileLoaderListener> listeners; 165 synchronized (inProgress) { 166 listeners = inProgress.remove(getCacheKey()); 167 } 161 Set<TileLoaderListener> listeners = inProgress.remove(getCacheKey()); 168 162 boolean status = result == LoadResult.SUCCESS; 169 163
Note:
See TracChangeset
for help on using the changeset viewer.