X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDataTreeCandidatePayload.java;h=d11ce38d72e7a6edd60711d446f268c90e457569;hb=8ed5603b4f3503559f2f85137c42d7605ebfd3e9;hp=25a7ee86229dcccf7b42a4c2d0eae1561c43ae12;hpb=ba87ed620f13823ee798fda4241a2c1db37e2f33;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCandidatePayload.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCandidatePayload.java index 25a7ee8622..d11ce38d72 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCandidatePayload.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCandidatePayload.java @@ -14,24 +14,25 @@ import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; -import java.util.AbstractMap.SimpleImmutableEntry; -import java.util.Map.Entry; -import java.util.Optional; -import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; import org.opendaylight.controller.cluster.datastore.persisted.DataTreeCandidateInputOutput; -import org.opendaylight.controller.cluster.datastore.persisted.DataTreeCandidateSupplier; +import org.opendaylight.controller.cluster.raft.persisted.MigratedSerializable; import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload; import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate; /** + * Payload wrapper for a DataTreeCandidatePayload. + * * @deprecated Deprecated in Boron in favor of CommitTransactionPayload */ @Deprecated -final class DataTreeCandidatePayload extends Payload implements DataTreeCandidateSupplier, Externalizable { +final class DataTreeCandidatePayload extends Payload implements Externalizable, MigratedSerializable { private static final long serialVersionUID = 1L; private transient byte[] serialized; + // 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 DataTreeCandidatePayload() { // Required by Externalizable } @@ -41,6 +42,8 @@ final class DataTreeCandidatePayload extends Payload implements DataTreeCandidat } /** + * Creates a DataTreeCandidatePayload. + * * @deprecated Use CommitTransactionPayload instead */ @Deprecated @@ -55,11 +58,8 @@ final class DataTreeCandidatePayload extends Payload implements DataTreeCandidat return new DataTreeCandidatePayload(out.toByteArray()); } - - @Override - public Entry, DataTreeCandidate> getCandidate() throws IOException { - return new SimpleImmutableEntry<>(Optional.empty(), - DataTreeCandidateInputOutput.readDataTreeCandidate(ByteStreams.newDataInput(serialized))); + public DataTreeCandidate getCandidate() throws IOException { + return DataTreeCandidateInputOutput.readDataTreeCandidate(ByteStreams.newDataInput(serialized)); } @Override @@ -83,4 +83,16 @@ final class DataTreeCandidatePayload extends Payload implements DataTreeCandidat serialized = new byte[length]; in.readFully(serialized); } + + @Override + public boolean isMigrated() { + return true; + } + + @Deprecated + @Override + public Object writeReplace() { + // this is fine + return this; + } }