Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize: mark the lockholder of branchsession as final #5487

Merged
merged 12 commits into from Apr 7, 2023

Conversation

funky-eyes
Copy link
Contributor

@funky-eyes funky-eyes commented Apr 3, 2023

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

优化branchsession中的lockhoder,只有AT分支才创建ConcurrentHashMap,其余情况下使用emptyMap,避免无意义的内存开销,并且将branchsession的lockhoder改为final类型,代表了该分支领域模型下是不可变的,语义更加符合也更加安全
无参构造方法由于太多地方引用,且大多数为file下测试及重启decode恢复数据(这块代码是在branchsession和globalsession内decode的,导致得先new个branchsession出来在decode,所以如果默认无参构造方法是emptyMap会导致恢复失败),考虑到这个pr视为减少运行时可能无意义的内存开销,所以正常的入口都是走的sesionhelper构建就已经达到目的了

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@funky-eyes funky-eyes requested a review from slievrly April 3, 2023 15:27
@funky-eyes funky-eyes changed the title optimize: Mark the lockhoder of branchsession as final optimize: Mark the lockholder of branchsession as final Apr 3, 2023
@funky-eyes funky-eyes added this to the 2.0.0 milestone Apr 3, 2023
Copy link
Member

@xingfudeshi xingfudeshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@slievrly slievrly changed the title optimize: Mark the lockholder of branchsession as final optimize: mark the lockholder of branchsession as final Apr 4, 2023
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@slievrly slievrly merged commit 7d6d602 into apache:2.x Apr 7, 2023
7 checks passed
liuqiufeng pushed a commit to liuqiufeng/seata that referenced this pull request Apr 20, 2023
Bughue pushed a commit to Bughue/seata that referenced this pull request May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants