Make Netty-3 dependency optional
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / persisted / UpdateElectionTerm.java
index ae86921b926ebab030fd8b1f457a20ef11b5001b..3ef7acbea369c35f4fa365ac5736aa0b3f34df7f 100644 (file)
@@ -7,59 +7,21 @@
  */
 package org.opendaylight.controller.cluster.raft.persisted;
 
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
 import java.io.Serializable;
 
 /**
  * Message class to persist election term information.
  */
-public class UpdateElectionTerm implements Serializable, MigratedSerializable {
-    private static final class Proxy implements Externalizable {
-        private static final long serialVersionUID = 1L;
-
-        private UpdateElectionTerm updateElectionTerm;
-
-        public Proxy() {
-            // For Externalizable
-        }
-
-        Proxy(final UpdateElectionTerm updateElectionTerm) {
-            this.updateElectionTerm = updateElectionTerm;
-        }
-
-        @Override
-        public void writeExternal(final ObjectOutput out) throws IOException {
-            out.writeLong(updateElectionTerm.currentTerm);
-            out.writeObject(updateElectionTerm.votedFor);
-         }
-
-        @Override
-        public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
-            updateElectionTerm = new UpdateElectionTerm(in.readLong(), (String) in.readObject());
-        }
-
-        private Object readResolve() {
-            return updateElectionTerm;
-        }
-    }
-
+public final class UpdateElectionTerm implements Serializable {
+    @java.io.Serial
     private static final long serialVersionUID = 1L;
 
     private final long currentTerm;
     private final String votedFor;
-    private final boolean migrated;
 
-    private UpdateElectionTerm(final long currentTerm, final String votedFor, final boolean migrated) {
+    public UpdateElectionTerm(final long currentTerm, final String votedFor) {
         this.currentTerm = currentTerm;
         this.votedFor = votedFor;
-        this.migrated = migrated;
-    }
-
-    public UpdateElectionTerm(final long currentTerm, final String votedFor) {
-        this(currentTerm, votedFor, false);
     }
 
     public long getCurrentTerm() {
@@ -70,24 +32,14 @@ public class UpdateElectionTerm implements Serializable, MigratedSerializable {
         return votedFor;
     }
 
-    @Override
-    public boolean isMigrated() {
-        return migrated;
-    }
-
-    @Override
-    public Object writeReplace() {
-        return new Proxy(this);
-    }
-
-    @Deprecated
-    public static UpdateElectionTerm createMigrated(final long currentTerm, final String votedFor) {
-        return new UpdateElectionTerm(currentTerm, votedFor, true);
-    }
-
     @Override
     public String toString() {
         return "UpdateElectionTerm [currentTerm=" + currentTerm + ", votedFor=" + votedFor + "]";
     }
+
+    @java.io.Serial
+    private Object writeReplace() {
+        return new UT(this);
+    }
 }