You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by cr...@apache.org on 2022/06/14 07:11:39 UTC

[dubbo] branch 3.0 updated: fix #10146, use concurrent hashmap to avoid ConcurrentModificationException (#10149)

This is an automated email from the ASF dual-hosted git repository.

crazyhzm pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new 64a96c5480 fix #10146, use concurrent hashmap to avoid ConcurrentModificationException (#10149)
64a96c5480 is described below

commit 64a96c5480c9ce2e92494d370ce68b4565983e1b
Author: ken.lj <ke...@gmail.com>
AuthorDate: Tue Jun 14 15:11:27 2022 +0800

    fix #10146, use concurrent hashmap to avoid ConcurrentModificationException (#10149)
---
 .../main/java/org/apache/dubbo/remoting/transport/CodecSupport.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/CodecSupport.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/CodecSupport.java
index 911ce55b6c..a963f2cdea 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/CodecSupport.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/CodecSupport.java
@@ -37,6 +37,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 import static org.apache.dubbo.common.BaseServiceMetadata.keyWithoutGroup;
 
@@ -46,7 +47,7 @@ public class CodecSupport {
     private static Map<Byte, String> ID_SERIALIZATIONNAME_MAP = new HashMap<Byte, String>();
     private static Map<String, Byte> SERIALIZATIONNAME_ID_MAP = new HashMap<String, Byte>();
     // Cache null object serialize results, for heartbeat request/response serialize use.
-    private static Map<Byte, byte[]> ID_NULLBYTES_MAP = new HashMap<Byte, byte[]>();
+    private static Map<Byte, byte[]> ID_NULLBYTES_MAP = new ConcurrentHashMap<>();
 
     private static final ThreadLocal<byte[]> TL_BUFFER = ThreadLocal.withInitial(() -> new byte[1024]);