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%2FRaftActorLeadershipTransferCohort.java;h=2916867ffdecd012033a12cd17cd1d5cb7ad9271;hp=b83bfd370948dc18a3826633568e2a78eeb650ac;hb=refs%2Fchanges%2F74%2F36874%2F3;hpb=135129e0cca66040fd512fab740d59b2ab1f8382 diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorLeadershipTransferCohort.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorLeadershipTransferCohort.java index b83bfd3709..2916867ffd 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorLeadershipTransferCohort.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorLeadershipTransferCohort.java @@ -52,16 +52,14 @@ public class RaftActorLeadershipTransferCohort { private static final Logger LOG = LoggerFactory.getLogger(RaftActorLeadershipTransferCohort.class); private final RaftActor raftActor; - private final ActorRef replyTo; private Cancellable newLeaderTimer; private final List onCompleteCallbacks = new ArrayList<>(); private long newLeaderTimeoutInMillis = 2000; private final Stopwatch transferTimer = Stopwatch.createUnstarted(); private boolean isTransferring; - RaftActorLeadershipTransferCohort(RaftActor raftActor, ActorRef replyTo) { + RaftActorLeadershipTransferCohort(RaftActor raftActor) { this.raftActor = raftActor; - this.replyTo = replyTo; } void init() { @@ -76,11 +74,10 @@ public class RaftActorLeadershipTransferCohort { currentBehavior.getLeaderPayloadVersion()), raftActor.self()); } - LeaderTransitioning leaderTransitioning = new LeaderTransitioning(); for(String peerId: context.getPeerIds()) { ActorSelection followerActor = context.getPeerActorSelection(peerId); if(followerActor != null) { - followerActor.tell(leaderTransitioning, context.getActor()); + followerActor.tell(LeaderTransitioning.INSTANCE, context.getActor()); } } @@ -171,9 +168,9 @@ public class RaftActorLeadershipTransferCohort { for(OnComplete onComplete: onCompleteCallbacks) { if(success) { - onComplete.onSuccess(raftActor.self(), replyTo); + onComplete.onSuccess(raftActor.self()); } else { - onComplete.onFailure(raftActor.self(), replyTo); + onComplete.onFailure(raftActor.self()); } } } @@ -192,7 +189,7 @@ public class RaftActorLeadershipTransferCohort { } interface OnComplete { - void onSuccess(ActorRef raftActorRef, ActorRef replyTo); - void onFailure(ActorRef raftActorRef, ActorRef replyTo); + void onSuccess(ActorRef raftActorRef); + void onFailure(ActorRef raftActorRef); } }