Repository navigation
fix(proxy): 避免动态代理生成争用全局类池 - #368
Merged
zhou-hao merged 1 commit intoSep 23, 2026
Merged
Conversation
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.
目的
FastBeanCopier同时生成代理时,竞争 Javassist 默认全局ClassPool锁导致请求长时间等待的问题。核心变动
hsweb-core的Proxy及FastBeanCopierColdStartContentionTest。Proxy使用独立ClassPool;类生成完成后清空仅用于生成的CtClass引用。Proxy仍可反复实例化已定义的目标类;不能再修改已生成的字节码模型。3d7cfeaff fix(proxy): 避免动态代理生成争用全局类池设计与测试目标
Map -> BeanCopier、字段复制正确性、既有 FastBeanCopier 回归及hsweb-core全量单元测试。ClassPool。通过独立池移除共享锁,16 线程冷启动回归测试覆盖原场景,既有复制测试覆盖兼容回归。测试结果
./mvnw.cmd -pl hsweb-core '-Dtest=FastBeanCopierColdStartContentionTest,FastBeanCopierTest' testFastBeanCopierColdStartContentionTest;16 个线程同步触发不同类型组合的首次复制,检查无 worker 阻塞在javassist.ClassPool,并校验复制字段。./mvnw.cmd -pl hsweb-core test全量 63 项通过,0 failures / 0 errors / 0 skipped,耗时 36.101 秒。hsweb-core(100 classes),当前模块未保留可供提取的行/分支覆盖率报告;以定向并发回归和全量 63 项单测作为替代验证。文档同步情况
风险与说明
hsweb-core动态代理生成与FastBeanCopier首次生成路径。Proxy仅保留已定义的目标类,符合原有生成后不可继续编辑的生命周期。ClassPool。3d7cfeaff。