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%2Fmessages%2FCommitTransaction.java;h=52ab643ad838987f32e0158811b177bef635023d;hb=8ec73bf853a9b6708b455c0321a585992e02b125;hp=14187139aafefd1758dd0dff444882b1ae4c54c9;hpb=6d73d16b194435ea1ea783a37d1b51fc1f558a1f;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransaction.java index 14187139aa..52ab643ad8 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CommitTransaction.java @@ -8,13 +8,37 @@ package org.opendaylight.controller.cluster.datastore.messages; +import org.opendaylight.controller.cluster.datastore.DataStoreVersions; import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages; -public class CommitTransaction implements SerializableMessage { - public static Class SERIALIZABLE_CLASS = ThreePhaseCommitCohortMessages.CommitTransaction.class; +public class CommitTransaction extends AbstractThreePhaseCommitMessage { + private static final long serialVersionUID = 1L; - @Override - public Object toSerializable() { - return ThreePhaseCommitCohortMessages.CommitTransaction.newBuilder().build(); - } + public CommitTransaction() { + } + + public CommitTransaction(String transactionID, final short version) { + super(transactionID, version); + } + + @Deprecated + @Override + protected Object newLegacySerializedInstance() { + return ThreePhaseCommitCohortMessages.CommitTransaction.newBuilder().setTransactionId( + getTransactionID()).build(); + } + + public static CommitTransaction fromSerializable(Object serializable) { + if(serializable instanceof CommitTransaction) { + return (CommitTransaction)serializable; + } else { + return new CommitTransaction(((ThreePhaseCommitCohortMessages.CommitTransaction)serializable). + getTransactionId(), DataStoreVersions.LITHIUM_VERSION); + } + } + + public static boolean isSerializedType(Object message) { + return message instanceof CommitTransaction || + message instanceof ThreePhaseCommitCohortMessages.CommitTransaction; + } }