X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fmessages%2FCommitTransactionReply.java;h=2b800c8346657ddf5f8ce7e005302c41856c76ff;hp=afeba298797ea2aead2879ec98d4100bde0996cd;hb=5a4560d475f0ed328275f1a5c7a5dae292acfb02;hpb=c222e37f2a0f0f3f6266242fbea2d3b018f4e6e3 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransactionReply.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransactionReply.java index afeba29879..2b800c8346 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransactionReply.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransactionReply.java @@ -8,14 +8,33 @@ package org.opendaylight.controller.cluster.datastore.messages; +import org.opendaylight.controller.cluster.datastore.DataStoreVersions; import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages; -public class CommitTransactionReply implements SerializableMessage { +public class CommitTransactionReply extends EmptyReply { + private static final Object SERIALIZED_INSTANCE = + ThreePhaseCommitCohortMessages.CommitTransactionReply.newBuilder().build(); - public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CommitTransactionReply.class; + public static final CommitTransactionReply INSTANCE = new CommitTransactionReply(); - @Override - public Object toSerializable() { - return ThreePhaseCommitCohortMessages.CommitTransactionReply.newBuilder().build(); - } + public CommitTransactionReply() { + } + + private CommitTransactionReply(short version) { + super(version); + } + + @Override + protected Object newLegacySerializedInstance() { + return SERIALIZED_INSTANCE; + } + + public static CommitTransactionReply instance(short version) { + return version == DataStoreVersions.CURRENT_VERSION ? INSTANCE : new CommitTransactionReply(version); + } + + public static boolean isSerializedType(Object message) { + return message instanceof CommitTransactionReply || + message instanceof ThreePhaseCommitCohortMessages.CommitTransactionReply; + } }