itwanger / itwanger/toBeBetterJavaer
关于ConcurrentHashMap迭代器遍历的问题
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
这里将ConcurrentHashMap归类于fail-safe是不对的,因为ConcurrentHashMap遍历时是弱一致性(Weakly Consistent),并不会在遍历时clone原始数据。
所以多线程场景下会有数据不一致问题,并且不会抛出异常。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the Java concurrency content shown in the issue and find the section that classifies ConcurrentHashMap iteration as fail-safe. Check the linked ConcurrentHashMap documentation, then update the explanation to describe weakly consistent iteration and its possible data inconsistency without exceptions. Done means the classification and explanation accurately match the Java documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100