【Enhancement】优化主流程lookProcessChain方法 issue #3513#3592
Open
LilMosey wants to merge 9 commits into
Open
Conversation
Author
|
@LearningGp 大佬能帮忙review一下吗?去年提过一次pr,但是当时用的是master分支 |
… 并发执行的场景。现有 double-check 可以修复临时读取为 null 的情况,但无法保证非空 ProcessorSlotChain 及其内部 slot 链被安全发布。ConcurrentHashMap 的非空读取与对应写入之间具备 happens-before,同时 get 不需要加互斥锁。现有同步块继续负责防止重复创建、精确控制 6000 容量上限,并保护 SlotChainProvider.newSlotChain()。这样既避免原 Copy-on-Write 每次新增资源都复制整张 Map 的 CPU 和 GC 开销,也保留了并发正确性。
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.
Describe what this PR does / why we need it
issue #3513
(详细信息都在issue里)
Does this pull request fix one issue?
issue #3513
Describe how you did it
Describe how to verify it
实现逻辑参照Collections.synchronizedMap()

原逻辑做了一次copyOnWrite操作,加锁后其实没必要进行copyOnWrite造成了资源浪费增加gc压力
Special notes for reviews