Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] ConcurrentHashMapUtils fails to solve the loop bug in JDK8. #6879

Closed
3 tasks done
leeyiyu opened this issue Jun 9, 2023 · 0 comments · Fixed by #6883
Closed
3 tasks done

[Bug] ConcurrentHashMapUtils fails to solve the loop bug in JDK8. #6879

leeyiyu opened this issue Jun 9, 2023 · 0 comments · Fixed by #6883
Labels

Comments

@leeyiyu
Copy link
Contributor

leeyiyu commented Jun 9, 2023

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

Mac OS 13.0

RocketMQ version

branch: (develop|tag 5.1.1) version: 5.1.1

JDK Version

jdk8

Describe the Bug

ConcurrentHashMapUtils 中提供的computeIfAbsent方法没有解决jdk8的循环问题,复现代码如下

@Test
    public void computeIfAbsent() {
        ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();
//        map.computeIfAbsent("AaAa", key->map.computeIfAbsent("BBBB",key2->"42"));
        ConcurrentHashMapUtils.computeIfAbsent(map, "AaAa", key -> map.computeIfAbsent("BBBB", key2 -> "42"));
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant