package org.opendaylight.controller.cluster.raft.behaviors;
import akka.actor.ActorRef;
+import javax.annotation.Nullable;
import org.opendaylight.controller.cluster.raft.RaftActorContext;
import org.opendaylight.controller.cluster.raft.RaftState;
import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
*
*/
public class IsolatedLeader extends AbstractLeader {
+ IsolatedLeader(RaftActorContext context, @Nullable AbstractLeader initializeFromLeader) {
+ super(context, RaftState.IsolatedLeader, initializeFromLeader);
+ }
+
public IsolatedLeader(RaftActorContext context) {
- super(context);
+ this(context, null);
}
// we received an Append Entries reply, we should switch the Behavior to Leader
// it can happen that this isolated leader interacts with a new leader in the cluster and
// changes its state to Follower, hence we only need to switch to Leader if the state is still Isolated
if (ret.state() == RaftState.IsolatedLeader && !isLeaderIsolated()) {
- LOG.info("IsolatedLeader {} switching from IsolatedLeader to Leader", leaderId);
- return switchBehavior(new Leader(context));
+ LOG.info("IsolatedLeader {} switching from IsolatedLeader to Leader", getLeaderId());
+ return internalSwitchBehavior(new Leader(context, this));
}
return ret;
}
-
- @Override
- public RaftState state() {
- return RaftState.IsolatedLeader;
- }
}