Commit 89f0fbd2 authored by Riegel's avatar Riegel
Browse files

Make LibraryObject and RelativeGeometry thread-safe

parent 84797654
Showing with 6 additions and 4 deletions
+6 -4
......@@ -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())) {
......
......@@ -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)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment