public static <K, V> V computeIfAbsent(ConcurrentMap<K, V> map, K key, Function<? super K, ? extends V> func) {
        Objects.requireNonNull(func);
        if (JRE.JAVA_8.isCurrentVersion()) {
            V v = map.get(key);
            if (null == v) {
                // issue#11986 lock bug
                // v = map.computeIfAbsent(key, func);

                // this bug fix methods maybe cause `func.apply` multiple calls.
                v = func.apply(key);
                if (null == v) {
                    return null;
                }
                final V res = map.putIfAbsent(key, v);
                if (null != res) {
                    // if pre value present, means other thread put value already, and putIfAbsent not effect
                    // return exist value
                    return res;
                }
                // if pre value is null, means putIfAbsent effected, return current value
            }
            return v;
        } else {
            return map.computeIfAbsent(key, func);
        }
    }
@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));

        // In JDK8，for the bug of JDK-8161372，may cause dead cycle when use computeIfAbsent
        // ConcurrentHashMapUtils.computeIfAbsent method to resolve this bug
        ConcurrentHashMapUtils.computeIfAbsent(map, "AaAa", key -> map.computeIfAbsent("BBBB", key2 -> 42));
        assertEquals(2, map.size());
        assertEquals(Integer.valueOf(42), map.get("AaAa"));
        assertEquals(Integer.valueOf(42), map.get("BBBB"));
    }