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%2FAbstractRaftActorBehavior.java;h=98cbd7b38179710e59733a0b08a2e53692e84f29;hp=106678e4742a666617a280f79399f91c73286126;hb=f7316a6d3025a879e6a84eba4e0ad12d96d9ae9c;hpb=348a37f613ef444b10a0e65b400390396552fc48 diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehavior.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehavior.java index 106678e474..98cbd7b381 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehavior.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractRaftActorBehavior.java @@ -25,7 +25,6 @@ import org.opendaylight.controller.cluster.raft.messages.AppendEntries; import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply; import org.opendaylight.controller.cluster.raft.messages.RequestVote; import org.opendaylight.controller.cluster.raft.messages.RequestVoteReply; -import org.opendaylight.yangtools.concepts.Identifier; import org.slf4j.Logger; import scala.concurrent.duration.FiniteDuration; @@ -314,14 +313,6 @@ public abstract class AbstractRaftActorBehavior implements RaftActorBehavior { return context.getReplicatedLog().lastIndex(); } - /** - * @param logIndex - * @return the client request tracker for the specified logIndex - */ - protected ClientRequestTracker findClientRequestTracker(long logIndex) { - return null; - } - /** * @param logIndex * @return the client request tracker for the specified logIndex @@ -330,7 +321,6 @@ public abstract class AbstractRaftActorBehavior implements RaftActorBehavior { return null; } - /** * * @return log index from the previous to last entry in the log @@ -365,22 +355,21 @@ public abstract class AbstractRaftActorBehavior implements RaftActorBehavior { long newLastApplied = context.getLastApplied(); // Now maybe we apply to the state machine for (long i = context.getLastApplied() + 1; i < index + 1; i++) { - final ActorRef clientActor; - final Identifier identifier; - final ClientRequestTracker tracker = removeClientRequestTracker(i); - if (tracker != null) { - clientActor = tracker.getClientActor(); - identifier = tracker.getIdentifier(); - } else { - clientActor = null; - identifier = null; - } ReplicatedLogEntry replicatedLogEntry = context.getReplicatedLog().get(i); if (replicatedLogEntry != null) { // Send a local message to the local RaftActor (it's derived class to be // specific to apply the log to it's index) - actor().tell(new ApplyState(clientActor, identifier, replicatedLogEntry), actor()); + + final ApplyState msg; + final ClientRequestTracker tracker = removeClientRequestTracker(i); + if (tracker != null) { + msg = new ApplyState(tracker.getClientActor(), tracker.getIdentifier(), replicatedLogEntry); + } else { + msg = new ApplyState(null, null, replicatedLogEntry); + } + + actor().tell(msg, actor()); newLastApplied = i; } else { //if one index is not present in the log, no point in looping