Changeset 17486 in josm


Ignore:
Timestamp:
2021-02-08T10:27:47+01:00 (2 months ago)
Author:
GerdP
Message:

see #20014: Tiles constantly reloading

  • change synchronization a bit. No idea if it helps.
  • simplify code
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractCachedTileSourceLayer.java

    r16913 r17486  
    5353            String key = this.getClass().getCanonicalName();
    5454            loaderFactory = loaderFactories.get(key);
    55             if (loaderFactory == null) {
    56                 synchronized (AbstractCachedTileSourceLayer.class) {
     55            synchronized (AbstractCachedTileSourceLayer.class) {
     56                if (loaderFactory == null) {
    5757                    // check again, maybe another thread initialized factory
    5858                    loaderFactory = loaderFactories.get(key);
     
    7878     */
    7979    private synchronized ICacheAccess<String, BufferedImageCacheEntry> getCache() {
    80         if (cache != null) {
    81             return cache;
     80        if (cache == null) {
     81            cache = JCSCacheManager.getCache(getCacheName(),
     82                    0,
     83                    getDiskCacheSize(),
     84                    CachedTileLoaderFactory.PROP_TILECACHE_DIR.get());
    8285        }
    83         cache = JCSCacheManager.getCache(getCacheName(),
    84                 0,
    85                 getDiskCacheSize(),
    86                 CachedTileLoaderFactory.PROP_TILECACHE_DIR.get());
    8786        return cache;
    8887    }
Note: See TracChangeset for help on using the changeset viewer.