confluentinc / confluentinc/common

There is a bug in CopyOnWriteMap

Open
#34 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
17
Forks
243
Avg merge
1d 21h
Merged PRs (30d)
38

Description

CopyOnWriteMap.entrySet() cannot simply delegate to map.entrySet() because we can use entryset.iterator().remove() method to remove elements from the map.As an example,the CopyOnWriterArrayList not allow to use iterator to remove elements.

After read your code, I implemented the CopyOnWriteMap, maybe it is better:
https://github.com/gaohanghbut/freetookit/blob/master/src/main/java/cn/yxffcode/freetookit/collection/CopyOnWriterMap.java

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the Java CopyOnWriteMap implementation and inspect CopyOnWriteMap.entrySet(), especially how its iterator handles remove(). Compare the intended behavior with CopyOnWriterArrayList and the referenced implementation at src/main/java/cn/yxffcode/freetookit/collection/CopyOnWriterMap.java; done means iterator removal cannot mutate the underlying map unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.