Changed referenceKeyMap entry value type to CopyOnWriteArrayList#15258
Merged
AlbumenJ merged 1 commit intoapache:3.3from May 7, 2025
Merged
Changed referenceKeyMap entry value type to CopyOnWriteArrayList#15258AlbumenJ merged 1 commit intoapache:3.3from
AlbumenJ merged 1 commit intoapache:3.3from
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.3 #15258 +/- ##
=========================================
Coverage 60.76% 60.77%
- Complexity 10892 10898 +6
=========================================
Files 1885 1885
Lines 86087 86086 -1
Branches 12896 12896
=========================================
+ Hits 52312 52320 +8
+ Misses 28324 28317 -7
+ Partials 5451 5449 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change?
see Resolving the Thread-Safety Problem in registerReferenceKeyAndBeanName Using an Overloaded computeIfAbsent #15219
org.apache.dubbo.config.spring.reference.ReferenceBeanManager.java
The ConcurrentHashMapUtils.computeIfAbsent method ensures the creation of a new list in a thread-safe manner when no list exists for the given referenceKey. However, the subsequent operations if (!list.contains(referenceBeanNameOrAlias)) and list.add(referenceBeanNameOrAlias) are not atomic. This situation can lead to thread-safety issues where multiple threads might simultaneously pass the contains check and then all perform the add operation, resulting in duplicate referenceBeanNameOrAlias entries within the list.
@AlbumenJ PTAL
Checklist