X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fbehaviors%2FLeader.java;h=ee3cc65dddb90815aecd50771c834d3ab461ecd4;hp=0dd39001136a25416c241eb8fb69085266d3752c;hb=989c3723e634bf4a0fb671246c31eadf255c462c;hpb=8cf40f4741c70a760dadb4300946c1dc88f95611 diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java index 0dd3900113..ee3cc65ddd 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.cluster.raft.behaviors; import akka.actor.ActorRef; @@ -74,7 +73,7 @@ public class Leader extends AbstractLeader { } protected void scheduleInstallSnapshotCheck(FiniteDuration interval) { - if(followers.size() == 0){ + if (getFollowerIds().isEmpty()) { // Optimization - do not bother scheduling a heartbeat as there are // no followers return; @@ -103,7 +102,8 @@ public class Leader extends AbstractLeader { context.getActorSystem().dispatcher(), context.getActor()); } - @Override public void close() throws Exception { + @Override + public void close() throws Exception { stopInstallSnapshotSchedule(); stopIsolatedLeaderCheckSchedule(); super.close(); @@ -111,6 +111,11 @@ public class Leader extends AbstractLeader { @VisibleForTesting void markFollowerActive(String followerId) { - followerToLog.get(followerId).markFollowerActive(); + getFollower(followerId).markFollowerActive(); + } + + @VisibleForTesting + void markFollowerInActive(String followerId) { + getFollower(followerId).markFollowerInActive(); } }