Changeset 8739 in josm for trunk/src/org


Ignore:
Timestamp:
2015-09-09T12:48:59+02:00 (5 years ago)
Author:
simon04
Message:

see #11833 - Attempt to fix infinite loop in MultipolygonCache (thanks to wiktorn)

This might occur on concurrent put operations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/MultipolygonCache.java

    r8512 r8739  
    44import java.util.ArrayList;
    55import java.util.Collection;
    6 import java.util.HashMap;
    76import java.util.Iterator;
    87import java.util.List;
    98import java.util.Map;
     9import java.util.concurrent.ConcurrentHashMap;
    1010
    1111import org.openstreetmap.josm.Main;
     
    4747
    4848    private MultipolygonCache() {
    49         this.cache = new HashMap<>();
     49        this.cache = new ConcurrentHashMap<>(); // see ticket 11833
    5050        this.selectedPolyData = new ArrayList<>();
    5151        Main.addProjectionChangeListener(this);
     
    8484            Map<DataSet, Map<Relation, Multipolygon>> map1 = cache.get(nc);
    8585            if (map1 == null) {
    86                 cache.put(nc, map1 = new HashMap<>());
     86                cache.put(nc, map1 = new ConcurrentHashMap<>());
    8787            }
    8888            Map<Relation, Multipolygon> map2 = map1.get(r.getDataSet());
    8989            if (map2 == null) {
    90                 map1.put(r.getDataSet(), map2 = new HashMap<>());
     90                map1.put(r.getDataSet(), map2 = new ConcurrentHashMap<>());
    9191            }
    9292            multipolygon = map2.get(r);
Note: See TracChangeset for help on using the changeset viewer.