Bug 3161: Create new UpdateElectionTerm class
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / RaftActor.java
index 1738cc5fe001ab8b30cfd105f67dc4d9adcc8200..b1ae4587c44eae1e6f85f331d133d41e7c721bea 100644 (file)
@@ -298,7 +298,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         Optional<ActorRef> roleChangeNotifier = getRoleChangeNotifier();
         if(!Objects.equal(oldBehaviorLeaderId, currentBehavior.getLeaderId())) {
             if(roleChangeNotifier.isPresent()) {
-                roleChangeNotifier.get().tell(new LeaderStateChanged(getId(), currentBehavior.getLeaderId()), getSelf());
+                roleChangeNotifier.get().tell(newLeaderStateChanged(getId(), currentBehavior.getLeaderId()), getSelf());
             }
 
             onLeaderChanged(oldBehaviorLeaderId, currentBehavior.getLeaderId());
@@ -311,6 +311,10 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         }
     }
 
+    protected LeaderStateChanged newLeaderStateChanged(String memberId, String leaderId) {
+        return new LeaderStateChanged(memberId, leaderId);
+    }
+
     /**
      * When a derived RaftActor needs to persist something it must call
      * persistData.
@@ -565,13 +569,14 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
     }
 
     /**
-     * @deprecated Deprecated in favor of {@link org.opendaylight.controller.cluster.raft.base.messages.DeleteEntriesTest}
+     * @deprecated Deprecated in favor of {@link org.opendaylight.controller.cluster.raft.base.messages.DeleteEntries}
      *             whose type for fromIndex is long instead of int. This class was kept for backwards
      *             compatibility with Helium.
      */
+    // Suppressing this warning as we can't set serialVersionUID to maintain backwards compatibility.
+    @SuppressWarnings("serial")
     @Deprecated
     static class DeleteEntries implements Serializable {
-        private static final long serialVersionUID = 1L;
         private final int fromIndex;
 
         public DeleteEntries(int fromIndex) {
@@ -583,8 +588,14 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
         }
     }
 
+    /**
+     * @deprecated Deprecated in favor of non-inner class {@link org.opendaylight.controller.cluster.raft.base.messages.UpdateElectionTerm}
+     *             which has serialVersionUID set. This class was kept for backwards compatibility with Helium.
+     */
+    // Suppressing this warning as we can't set serialVersionUID to maintain backwards compatibility.
+    @SuppressWarnings("serial")
+    @Deprecated
     static class UpdateElectionTerm implements Serializable {
-        private static final long serialVersionUID = 1L;
         private final long currentTerm;
         private final String votedFor;