diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LibraryObject.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LibraryObject.java index 4f99f87d181d47b742868f23daabed79263cbfda..f1e2024c079b2e83ac3ae8ad766cdff0fbce1893 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LibraryObject.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LibraryObject.java @@ -9,8 +9,9 @@ import org.apache.logging.log4j.Logger; import java.io.Serial; import java.nio.file.Path; -import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; /** * Reference object for handling of implicit geometries with a library object contained in an external file @@ -24,7 +25,7 @@ public class LibraryObject extends Geometry { private static final long serialVersionUID = -50293435187454911L; private final String filepath; private final ParserConfiguration config; - private static HashMap<String, LibraryObject> libraryObjects = new HashMap<>(); + private static Map<String, LibraryObject> libraryObjects = new ConcurrentHashMap<>(); public static LibraryObject of(Path path, ParserConfiguration config) { if (libraryObjects.containsKey(path.toString())) { diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/RelativeGeometry.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/RelativeGeometry.java index 987b3c9f85d02da17fca2c48211e576fa1bbbf44..bbacc03a7f8266db710cc83f154baf8b0112cc63 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/RelativeGeometry.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/RelativeGeometry.java @@ -5,7 +5,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.io.Serial; -import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; /** * Reference object for handling of implicit geometries with a relative geometry @@ -18,7 +19,7 @@ public class RelativeGeometry extends Geometry { @Serial private static final long serialVersionUID = -686112245455298977L; - private static HashMap<Geometry, RelativeGeometry> relativeGeometries = new HashMap<>(); + private static Map<Geometry, RelativeGeometry> relativeGeometries = new ConcurrentHashMap<>(); public static RelativeGeometry of(Geometry geom) { if (relativeGeometries.containsKey(geom)) {