From 075db16db03a32a51fd43d9b40e51327fffc1904 Mon Sep 17 00:00:00 2001 From: Yuhui Date: Tue, 16 Jan 2024 22:26:55 +0800 Subject: [PATCH] [#1495] fix(core): Change the HashMap to ConcurrentMap in ProtoEntitySerDe (#1525) ### What changes were proposed in this pull request? Fix ConcurrentModificationException threw in function `ProtoEntitySerDe:getProtoClass()` ### Why are the changes needed? Fix: #1495 ### Does this PR introduce _any_ user-facing change? NO ### How was this patch tested? The TrinoQueryIT tester has been run successfully many times. However, before this change, it sometimes fails due to a ConcurrentModificationException --- .../java/com/datastrato/gravitino/proto/ProtoEntitySerDe.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/datastrato/gravitino/proto/ProtoEntitySerDe.java b/core/src/main/java/com/datastrato/gravitino/proto/ProtoEntitySerDe.java index 646a0e3ed79..08c00b6b6bf 100644 --- a/core/src/main/java/com/datastrato/gravitino/proto/ProtoEntitySerDe.java +++ b/core/src/main/java/com/datastrato/gravitino/proto/ProtoEntitySerDe.java @@ -60,8 +60,8 @@ public class ProtoEntitySerDe implements EntitySerDe { private final Map, Class> entityToProto; public ProtoEntitySerDe() { - this.entityToSerDe = Maps.newHashMap(); - this.entityToProto = Maps.newHashMap(); + this.entityToSerDe = Maps.newConcurrentMap(); + this.entityToProto = Maps.newConcurrentMap(); } @Override