BUG-5626: Move leaderId/leaderPayloadVersion fields
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / behaviors / IsolatedLeader.java
index 4f77711a4d5af7dcf57f119f026e6c40e9516531..c969586722d3a849a7fd51ebf1d02c51463d4db3 100644 (file)
@@ -27,7 +27,7 @@ import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
  */
 public class IsolatedLeader extends AbstractLeader {
     public IsolatedLeader(RaftActorContext context) {
-        super(context);
+        super(context, RaftState.IsolatedLeader);
     }
 
     // we received an Append Entries reply, we should switch the Behavior to Leader
@@ -39,14 +39,9 @@ public class IsolatedLeader extends AbstractLeader {
         // 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(RaftState.Leader);
         }
         return ret;
     }
-
-    @Override
-    public RaftState state() {
-        return RaftState.IsolatedLeader;
-    }
 }