X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDataTreeCandidatePayload.java;h=d11ce38d72e7a6edd60711d446f268c90e457569;hb=e7da6f458d9278b2276671dc3164c9cde24ac9ef;hp=8da70c2e29cc8a7c5019873e19dfe55ab9ea4f04;hpb=175f38490b56c4b4e0ec356b17b91f887b295da4;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 8da70c2e29..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 @@ -15,17 +15,24 @@ import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import org.opendaylight.controller.cluster.datastore.persisted.DataTreeCandidateInputOutput; +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; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -final class DataTreeCandidatePayload extends Payload implements Externalizable { - private static final Logger LOG = LoggerFactory.getLogger(DataTreeCandidatePayload.class); +/** + * Payload wrapper for a DataTreeCandidatePayload. + * + * @deprecated Deprecated in Boron in favor of CommitTransactionPayload + */ +@Deprecated +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 } @@ -34,6 +41,12 @@ final class DataTreeCandidatePayload extends Payload implements Externalizable { this.serialized = Preconditions.checkNotNull(serialized); } + /** + * Creates a DataTreeCandidatePayload. + * + * @deprecated Use CommitTransactionPayload instead + */ + @Deprecated static DataTreeCandidatePayload create(final DataTreeCandidate candidate) { final ByteArrayDataOutput out = ByteStreams.newDataOutput(); try { @@ -45,8 +58,7 @@ final class DataTreeCandidatePayload extends Payload implements Externalizable { return new DataTreeCandidatePayload(out.toByteArray()); } - - DataTreeCandidate getCandidate() throws IOException { + public DataTreeCandidate getCandidate() throws IOException { return DataTreeCandidateInputOutput.readDataTreeCandidate(ByteStreams.newDataInput(serialized)); } @@ -71,4 +83,16 @@ final class DataTreeCandidatePayload extends Payload implements Externalizable { serialized = new byte[length]; in.readFully(serialized); } + + @Override + public boolean isMigrated() { + return true; + } + + @Deprecated + @Override + public Object writeReplace() { + // this is fine + return this; + } }