Make Netty-3 dependency optional
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / persisted / ApplyJournalEntries.java
index cad23a93980aa816363ab2f03c5f3ec229ee3088..30da667c2695c666f04eaae0d3f2a216772fe125 100644 (file)
@@ -7,10 +7,7 @@
  */
 package org.opendaylight.controller.cluster.raft.persisted;
 
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
+import akka.dispatch.ControlMessage;
 import java.io.Serializable;
 
 /**
@@ -21,73 +18,27 @@ import java.io.Serializable;
  *
  * @author Thomas Pantelis
  */
-public class ApplyJournalEntries implements Serializable, MigratedSerializable {
-    private static final class Proxy implements Externalizable {
-        private static final long serialVersionUID = 1L;
-
-        private ApplyJournalEntries applyEntries;
-
-        // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
-        // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
-        @SuppressWarnings("checkstyle:RedundantModifier")
-        public Proxy() {
-            // For Externalizable
-        }
-
-        Proxy(final ApplyJournalEntries applyEntries) {
-            this.applyEntries = applyEntries;
-        }
-
-        @Override
-        public void writeExternal(final ObjectOutput out) throws IOException {
-            out.writeLong(applyEntries.toIndex);
-        }
-
-        @Override
-        public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
-            applyEntries = new ApplyJournalEntries(in.readLong());
-        }
-
-        private Object readResolve() {
-            return applyEntries;
-        }
-    }
-
+public final class ApplyJournalEntries implements Serializable, ControlMessage {
+    @java.io.Serial
     private static final long serialVersionUID = 1L;
 
     private final long toIndex;
-    private final boolean migrated;
-
-    private ApplyJournalEntries(final long toIndex, final boolean migrated) {
-        this.toIndex = toIndex;
-        this.migrated = migrated;
-    }
 
     public ApplyJournalEntries(final long toIndex) {
-        this(toIndex, false);
+        this.toIndex = toIndex;
     }
 
     public long getToIndex() {
         return toIndex;
     }
 
-    @Override
-    public boolean isMigrated() {
-        return migrated;
-    }
-
-    @Override
-    public Object writeReplace() {
-        return new Proxy(this);
-    }
-
-    @Deprecated
-    public static ApplyJournalEntries createMigrated(final long fromIndex) {
-        return new ApplyJournalEntries(fromIndex, true);
-    }
-
     @Override
     public String toString() {
         return "ApplyJournalEntries [toIndex=" + toIndex + "]";
     }
+
+    @java.io.Serial
+    private Object writeReplace() {
+        return new AJE(this);
+    }
 }