You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "looly (via GitHub)" <gi...@apache.org> on 2023/04/04 10:53:02 UTC

[GitHub] [dubbo] looly commented on a diff in pull request #11987: fix #11986 ConcurrentHashMapUtils lock bug

looly commented on code in PR #11987:
URL: https://github.com/apache/dubbo/pull/11987#discussion_r1157074127


##########
dubbo-common/src/test/java/org/apache/dubbo/common/utils/ConcurrentHashMapUtilsTest.java:
##########
@@ -37,4 +37,17 @@ public void testComputeIfAbsent() {
         ifAbsent = ConcurrentHashMapUtils.computeIfAbsent(map, "mxsm", k -> "mxsm1");
         assertEquals("mxsm1", ifAbsent);
     }
+
+    @Test
+    public void issue11986Test(){
+        // https://github.com/apache/dubbo/issues/11986
+        final ConcurrentHashMap<String,Integer> map=new ConcurrentHashMap<>();
+        // // map.computeIfAbsent("AaAa", key->map.computeIfAbsent("BBBB",key2->42));
+        if (JRE.JAVA_8.isCurrentVersion()) {

Review Comment:
   并不是。这个bug在JDK8下会造成循环调用,但是jdk9+修复了这个问题,解决方式是有循环调用则抛出异常。这个test在jdk8下通过,jdk9+抛出异常。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org