itwanger / itwanger/toBeBetterJavaer

关于ConcurrentHashMap迭代器遍历的问题

Open
#195 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
17.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

Image

这里将ConcurrentHashMap归类于fail-safe是不对的,因为ConcurrentHashMap遍历时是弱一致性(Weakly Consistent),并不会在遍历时clone原始数据。

所以多线程场景下会有数据不一致问题,并且不会抛出异常。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.