23
23
import java .util .List ;
24
24
import java .util .Map ;
25
25
import java .util .Set ;
26
+ import java .util .concurrent .ConcurrentHashMap ;
26
27
import java .util .function .BiFunction ;
27
28
import java .util .function .Function ;
28
29
@@ -42,15 +43,15 @@ final class NodeDescriptionStore {
42
43
* A lookup of entities based on their primary label. We depend on the locking mechanism provided by the
43
44
* {@link AbstractMappingContext}, so this lookup is not synchronized further.
44
45
*/
45
- private final Map <String , NodeDescription <?>> nodeDescriptionsByPrimaryLabel = new HashMap <>();
46
+ private final Map <String , NodeDescription <?>> nodeDescriptionsByPrimaryLabel = new ConcurrentHashMap <>();
46
47
47
- private final Map <NodeDescription <?>, Map <List <String >, NodeDescriptionAndLabels >> nodeDescriptionAndLabelsCache = new HashMap <>();
48
+ private final Map <NodeDescription <?>, Map <List <String >, NodeDescriptionAndLabels >> nodeDescriptionAndLabelsCache = new ConcurrentHashMap <>();
48
49
49
50
private final BiFunction <NodeDescription <?>, List <String >, NodeDescriptionAndLabels > nodeDescriptionAndLabels =
50
51
(nodeDescription , labels ) -> {
51
52
Map <List <String >, NodeDescriptionAndLabels > listNodeDescriptionAndLabelsMap = nodeDescriptionAndLabelsCache .get (nodeDescription );
52
53
if (listNodeDescriptionAndLabelsMap == null ) {
53
- nodeDescriptionAndLabelsCache .put (nodeDescription , new HashMap <>());
54
+ nodeDescriptionAndLabelsCache .put (nodeDescription , new ConcurrentHashMap <>());
54
55
listNodeDescriptionAndLabelsMap = nodeDescriptionAndLabelsCache .get (nodeDescription );
55
56
}
56
57
0 commit comments