AlbumenJ commented on code in PR #11987:
URL: https://github.com/apache/dubbo/pull/11987#discussion_r1165497089
##########
dubbo-common/src/test/java/org/apache/dubbo/common/utils/ConcurrentHashMapUtilsTest.java:
##########
@@ -37,4 +39,31 @@ public void testComputeIfAbsent() {
ifAbsent = ConcurrentHashMapUtils.computeIfAbsent(map, "mxsm", k ->
"mxsm1");
assertEquals("mxsm1", ifAbsent);
}
+
+ @Test
+ @EnabledForJreRange(max = org.junit.jupiter.api.condition.JRE.JAVA_8)
+ public void issue11986ForJava8Test(){
+ // https://github.com/apache/dubbo/issues/11986
+ final ConcurrentHashMap<String,Integer> map=new ConcurrentHashMap<>();
+ // // map.computeIfAbsent("AaAa",
key->map.computeIfAbsent("BBBB",key2->42));
+
+ // JDK8下,由于循环调用bug,会造成执行computeIfAbsent死循环问题
+ // ConcurrentHashMapUtils.computeIfAbsent用于解决此问题,保证正常执行
Review Comment:
Please comment in English
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]