Skip to content

Commit

Permalink
revert and fix spotbugs
Browse files Browse the repository at this point in the history
  • Loading branch information
133tosakarin committed Oct 21, 2024
1 parent f9b74f6 commit a7264ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,8 @@ private void runImpl() {
}

private boolean shouldRun() {
synchronized (server) {
final DivisionInfo info = server.getInfo();
return lifeCycle.getCurrentState().isRunning() && info.isCandidate() && info.isAlive();
}
final DivisionInfo info = server.getInfo();
return lifeCycle.getCurrentState().isRunning() && info.isCandidate() && info.isAlive();
}

private boolean shouldRun(long electionTerm) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ public void close() {
LOG.warn("{}: Failed to shutdown LeaderElection", getMemberId(), e);
}
try{
role.shutdownLeaderState(true);
role.shutdownLeaderState(true).join();
} catch (Exception e) {
LOG.warn("{}: Failed to shutdown LeaderState monitor", getMemberId(), e);
}
Expand Down Expand Up @@ -620,7 +620,7 @@ synchronized CompletableFuture<Void> changeToFollowerAndPersistMetadata(

synchronized void changeToLeader() {
Preconditions.assertTrue(getInfo().isCandidate());
CompletableFuture<Void> future = role.shutdownLeaderElection();
role.shutdownLeaderElection();
setRole(RaftPeerRole.LEADER, "changeToLeader");
final LeaderStateImpl leader = role.updateLeaderState(this);
state.becomeLeader();
Expand Down

0 comments on commit a7264ef

Please sign in to comment.