-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
bugfix: fix that rpcServer is not closed when raftServer is closed #5977
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## 2.x #5977 +/- ##
============================================
+ Coverage 48.05% 48.08% +0.02%
- Complexity 4611 4614 +3
============================================
Files 911 911
Lines 31285 31287 +2
Branches 3768 3767 -1
============================================
+ Hits 15034 15044 +10
+ Misses 14736 14728 -8
Partials 1515 1515
|
LOGGER.error(e.getMessage()); | ||
} | ||
} | ||
RaftServerFactory.getInstance().destroy(); |
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.
In the future, it is necessary to refactor the code to decouple SessionHolder with RaftXXX.
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.
In the future, it is necessary to refactor the code to decouple SessionHolder with RaftXXX.
Since the raft cluster must match the raft mode exactly, it must be written in the sessionHolder, otherwise the timing of the initialization is not very controllable, and the raft cluster must be started after the sessionmanager has finished initializing, otherwise there may be npe issues
} | ||
|
||
@Override | ||
public void close() { |
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.
The general purpose of the Java Factory class is to create and return objects of other classes, not to control behavior. If rpcServer is part of RaftServer, then it is more appropriate to control behavior in RaftServer.
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.
The general purpose of the Java Factory class is to create and return objects of other classes, not to control behavior. If rpcServer is part of RaftServer, then it is more appropriate to control behavior in RaftServer.
A single rpc server can be used by multiple raft servers, so all raft servers should be controlled in the raft server factory, as well as their behavior when destroyed.
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
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
fixes #5976
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews