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
Conversation
This file contains 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
funky-eyes
changed the title
optimize: Mark the lockhoder of branchsession as final
optimize: Mark the lockholder of branchsession as final
Apr 3, 2023
xingfudeshi
approved these changes
Apr 4, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
slievrly
changed the title
optimize: Mark the lockholder of branchsession as final
optimize: mark the lockholder of branchsession as final
Apr 4, 2023
slievrly
reviewed
Apr 4, 2023
server/src/main/java/io/seata/server/storage/file/lock/FileLocker.java
Outdated
Show resolved
Hide resolved
slievrly
reviewed
Apr 4, 2023
slievrly
approved these changes
Apr 7, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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
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 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