Skip to content

Commit

Permalink
(feat) Node#isLeader doesn't need read locking (sofastack#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
killme2008 authored May 12, 2020
1 parent 090b5d4 commit 7f1f74e
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2624,12 +2624,7 @@ private void handleVoteTimeout() {

@Override
public boolean isLeader() {
this.readLock.lock();
try {
return this.state == State.STATE_LEADER;
} finally {
this.readLock.unlock();
}
return this.state == State.STATE_LEADER;
}

@Override
Expand Down

0 comments on commit 7f1f74e

Please sign in to comment.