Fix for ConcurrentModificationException in markers code

This commit is contained in:
Mike Primm 2019-07-21 13:16:05 -05:00
parent e046f2576c
commit f1b7741f65

View File

@ -21,15 +21,15 @@ import org.dynmap.markers.MarkerSet;
import org.dynmap.markers.impl.MarkerAPIImpl.MarkerUpdate; import org.dynmap.markers.impl.MarkerAPIImpl.MarkerUpdate;
class MarkerSetImpl implements MarkerSet { class MarkerSetImpl implements MarkerSet {
private HashMap<String, MarkerImpl> markers = new HashMap<String, MarkerImpl>(); private ConcurrentHashMap<String, MarkerImpl> markers = new ConcurrentHashMap<String, MarkerImpl>();
private HashMap<String, AreaMarkerImpl> areamarkers = new HashMap<String, AreaMarkerImpl>(); private ConcurrentHashMap<String, AreaMarkerImpl> areamarkers = new ConcurrentHashMap<String, AreaMarkerImpl>();
private HashMap<String, PolyLineMarkerImpl> linemarkers = new HashMap<String, PolyLineMarkerImpl>(); private ConcurrentHashMap<String, PolyLineMarkerImpl> linemarkers = new ConcurrentHashMap<String, PolyLineMarkerImpl>();
private HashMap<String, CircleMarkerImpl> circlemarkers = new HashMap<String, CircleMarkerImpl>(); private ConcurrentHashMap<String, CircleMarkerImpl> circlemarkers = new ConcurrentHashMap<String, CircleMarkerImpl>();
private ConcurrentHashMap<String, AreaMarkerImpl> boostingareamarkers = null; private ConcurrentHashMap<String, AreaMarkerImpl> boostingareamarkers = null;
private ConcurrentHashMap<String, CircleMarkerImpl> boostingcirclemarkers = null; private ConcurrentHashMap<String, CircleMarkerImpl> boostingcirclemarkers = null;
private String setid; private String setid;
private String label; private String label;
private HashMap<String, MarkerIconImpl> allowedicons = null; private ConcurrentHashMap<String, MarkerIconImpl> allowedicons = null;
private boolean hide_by_def; private boolean hide_by_def;
private boolean ispersistent; private boolean ispersistent;
private int prio = 0; private int prio = 0;
@ -51,7 +51,7 @@ class MarkerSetImpl implements MarkerSet {
else else
label = id; label = id;
if(iconlimit != null) { if(iconlimit != null) {
allowedicons = new HashMap<String, MarkerIconImpl>(); allowedicons = new ConcurrentHashMap<String, MarkerIconImpl>();
for(MarkerIcon ico : iconlimit) { for(MarkerIcon ico : iconlimit) {
if(ico instanceof MarkerIconImpl) { if(ico instanceof MarkerIconImpl) {
allowedicons.put(ico.getMarkerIconID(), (MarkerIconImpl)ico); allowedicons.put(ico.getMarkerIconID(), (MarkerIconImpl)ico);