fix(common): 修复共享基础组件并发竞态#707
Open
zhibeigg wants to merge 1 commit into
Open
Conversation
保证事件监听、类访问器缓存与延迟集合并发安全,并让命令树只构建一次且隔离每次执行结果。
11 tasks
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.
原有问题
多个全局共享基础组件使用了非原子的“读取—修改—写回”或无保护可变集合:
ClassVisitorHandler的访问器、延迟类集合和懒加载类集在并行扫描、注册与读取时缺少安全发布。典型触发场景与后果
ConcurrentModificationException、漏扫类或读取到未完整初始化的集合。本 PR 修改
ClassVisitorHandler的共享集合增加线程安全访问和可靠发布,统一延迟初始化流程。修改目的
消除框架启动和运行阶段的时序依赖,使事件注册、类扫描和命令系统在并发环境下保持确定性,不再出现难以复现的监听器丢失或状态串扰。
兼容性与行为变化
验证
./gradlew :common-util:test :common-platform-api:test --rerun-tasks --no-parallel./gradlew :common-util:build :common-platform-api:build --rerun-tasks --no-parallelgit diff --checkRefs #703