Skip to content

Commit b22e547

Browse files
committed
GH-2585 - Make type detection by label more robust.
Closes #2585
1 parent abb8d64 commit b22e547

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/org/springframework/data/neo4j/core/mapping/NodeDescriptionStore.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.List;
2424
import java.util.Map;
2525
import java.util.Set;
26+
import java.util.concurrent.ConcurrentHashMap;
2627
import java.util.function.BiFunction;
2728
import java.util.function.Function;
2829

@@ -42,15 +43,15 @@ final class NodeDescriptionStore {
4243
* A lookup of entities based on their primary label. We depend on the locking mechanism provided by the
4344
* {@link AbstractMappingContext}, so this lookup is not synchronized further.
4445
*/
45-
private final Map<String, NodeDescription<?>> nodeDescriptionsByPrimaryLabel = new HashMap<>();
46+
private final Map<String, NodeDescription<?>> nodeDescriptionsByPrimaryLabel = new ConcurrentHashMap<>();
4647

47-
private final Map<NodeDescription<?>, Map<List<String>, NodeDescriptionAndLabels>> nodeDescriptionAndLabelsCache = new HashMap<>();
48+
private final Map<NodeDescription<?>, Map<List<String>, NodeDescriptionAndLabels>> nodeDescriptionAndLabelsCache = new ConcurrentHashMap<>();
4849

4950
private final BiFunction<NodeDescription<?>, List<String>, NodeDescriptionAndLabels> nodeDescriptionAndLabels =
5051
(nodeDescription, labels) -> {
5152
Map<List<String>, NodeDescriptionAndLabels> listNodeDescriptionAndLabelsMap = nodeDescriptionAndLabelsCache.get(nodeDescription);
5253
if (listNodeDescriptionAndLabelsMap == null) {
53-
nodeDescriptionAndLabelsCache.put(nodeDescription, new HashMap<>());
54+
nodeDescriptionAndLabelsCache.put(nodeDescription, new ConcurrentHashMap<>());
5455
listNodeDescriptionAndLabelsMap = nodeDescriptionAndLabelsCache.get(nodeDescription);
5556
}
5657

0 commit comments

Comments
 (0)