Add new cds-access-api proxies
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / SkipTransactionsRequestV1.java
index 26d660f1d9d5580f46de0d41add9aaf9fe937970..762289c0bc3687067fbd81d3114cf2ec151958f1 100644 (file)
@@ -7,27 +7,15 @@
  */
 package org.opendaylight.controller.cluster.access.commands;
 
-import akka.actor.ActorRef;
-import com.google.common.collect.ImmutableList;
-import com.google.common.primitives.UnsignedLong;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.Serial;
-import java.util.List;
-import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
-import org.opendaylight.yangtools.concepts.WritableObjects;
-
 /**
  * Externalizable proxy for use with {@link SkipTransactionsRequest}. It implements the initial
  * (Phosphorus SR1) serialization format.
  */
-final class SkipTransactionsRequestV1 extends AbstractTransactionRequestProxy<SkipTransactionsRequest> {
-    @Serial
+final class SkipTransactionsRequestV1 extends AbstractTransactionRequestProxy<SkipTransactionsRequest>
+        implements SkipTransactionsRequest.SerialForm {
+    @java.io.Serial
     private static final long serialVersionUID = -7493419007644462643L;
 
-    private List<UnsignedLong> others;
-
     // checkstyle flags the public modifier as redundant however it is explicitly needed for Java serialization to
     // be able to create instances via reflection.
     @SuppressWarnings("checkstyle:RedundantModifier")
@@ -37,52 +25,5 @@ final class SkipTransactionsRequestV1 extends AbstractTransactionRequestProxy<Sk
 
     SkipTransactionsRequestV1(final SkipTransactionsRequest request) {
         super(request);
-        others = request.getOthers();
-    }
-
-    @Override
-    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
-        super.readExternal(in);
-
-        final int size = in.readInt();
-        final var builder = ImmutableList.<UnsignedLong>builderWithExpectedSize(size);
-        int idx;
-        if (size % 2 != 0) {
-            builder.add(UnsignedLong.fromLongBits(WritableObjects.readLong(in)));
-            idx = 1;
-        } else {
-            idx = 0;
-        }
-        for (; idx < size; idx += 2) {
-            final byte hdr = WritableObjects.readLongHeader(in);
-            builder.add(UnsignedLong.fromLongBits(WritableObjects.readFirstLong(in, hdr)));
-            builder.add(UnsignedLong.fromLongBits(WritableObjects.readSecondLong(in, hdr)));
-        }
-        others = builder.build();
-    }
-
-    @Override
-    public void writeExternal(final ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        final int size = others.size();
-        out.writeInt(size);
-
-        int idx;
-        if (size % 2 != 0) {
-            WritableObjects.writeLong(out, others.get(0).longValue());
-            idx = 1;
-        } else {
-            idx = 0;
-        }
-        for (; idx < size; idx += 2) {
-            WritableObjects.writeLongs(out, others.get(idx).longValue(), others.get(idx + 1).longValue());
-        }
-    }
-
-    @Override
-    protected SkipTransactionsRequest createRequest(final TransactionIdentifier target, final long sequence,
-            final ActorRef replyToActor) {
-        return new SkipTransactionsRequest(target, sequence, replyToActor, others);
     }
 }