Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
89f0fbd2
Commit
89f0fbd2
authored
Nov 08, 2024
by
Riegel
Browse files
Make LibraryObject and RelativeGeometry thread-safe
parent
84797654
Changes
2
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/LibraryObject.java
View file @
89f0fbd2
...
...
@@ -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
Hash
Map
<
String
,
LibraryObject
>
libraryObjects
=
new
HashMap
<>();
private
static
Map
<
String
,
LibraryObject
>
libraryObjects
=
new
Concurrent
HashMap
<>();
public
static
LibraryObject
of
(
Path
path
,
ParserConfiguration
config
)
{
if
(
libraryObjects
.
containsKey
(
path
.
toString
()))
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/RelativeGeometry.java
View file @
89f0fbd2
...
...
@@ -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
Hash
Map
<
Geometry
,
RelativeGeometry
>
relativeGeometries
=
new
HashMap
<>();
private
static
Map
<
Geometry
,
RelativeGeometry
>
relativeGeometries
=
new
Concurrent
HashMap
<>();
public
static
RelativeGeometry
of
(
Geometry
geom
)
{
if
(
relativeGeometries
.
containsKey
(
geom
))
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment