altosui: Use ConcurrentHashMap for maps
authorKeith Packard <keithp@keithp.com>
Tue, 27 Mar 2012 05:05:04 +0000 (22:05 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 27 Mar 2012 05:05:04 +0000 (22:05 -0700)
This data structure is accessed by multiple threads, so it needs to be
re-entrant.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosSiteMap.java

index c258b3e5559728f364105d0794f89f4c8eba9784..63995c402eac5fdb520e9cfaa9788cd58246fce9 100644 (file)
@@ -31,6 +31,7 @@ import java.util.prefs.*;
 import java.lang.Math;
 import java.awt.geom.Point2D;
 import java.awt.geom.Line2D;
+import java.util.concurrent.*;
 
 public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
        // preferred vertical step in a tile in naut. miles
@@ -110,7 +111,7 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
                return latlng(pt, scale_x, scale_y);
        }
 
-       HashMap<Point,AltosSiteMapTile> mapTiles = new HashMap<Point,AltosSiteMapTile>();
+       ConcurrentHashMap<Point,AltosSiteMapTile> mapTiles = new ConcurrentHashMap<Point,AltosSiteMapTile>();
        Point2D.Double centre;
 
        private Point2D.Double tileCoordOffset(Point p) {