Remove Needless Synchronization in FollowersChecker (#44631) (#44680)

* It seems redundant to synchronize here and check that the map hasn't checked via the `isRunning` under the mutex
* The map won't change if under the mutex that locks on all the updates to it
* Without the mutex it's very unlikely to change inside the method call relative to the likelihood of changing until the generic pool where we check for `isRunning` again anyway

-> just remove the synchronization (it's on the IO loop) and check since we do check the running state on the generic pool under the mutex anyway when we actually fail it
This commit is contained in:
Armin Braun 2019-07-22 10:57:30 +02:00 committed by GitHub
parent ff76b0af8b
commit b9067ba1ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -249,13 +249,11 @@ public class FollowersChecker {
}
private void handleDisconnectedNode(DiscoveryNode discoveryNode) {
synchronized (mutex) {
FollowerChecker followerChecker = followerCheckers.get(discoveryNode);
if (followerChecker != null && followerChecker.running()) {
if (followerChecker != null) {
followerChecker.failNode("disconnected");
}
}
}
static class FastResponseState {
final long term;