Fix javadoc formatting
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / CanCommitTransactionReply.java
index fa4fca508916725db298b4bb7bc20e1863005b3e..f346cba4334ffce9b93f1ff53e33b9e0401d94fa 100644 (file)
@@ -8,11 +8,11 @@
 
 package org.opendaylight.controller.cluster.datastore.messages;
 
+import com.google.common.base.Preconditions;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
-import org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages;
 
 public class CanCommitTransactionReply extends VersionedExternalizableMessage {
     private static final CanCommitTransactionReply YES =
@@ -20,12 +20,6 @@ public class CanCommitTransactionReply extends VersionedExternalizableMessage {
     private static final CanCommitTransactionReply NO =
             new CanCommitTransactionReply(false, DataStoreVersions.CURRENT_VERSION);
 
-    private static final ThreePhaseCommitCohortMessages.CanCommitTransactionReply YES_SERIALIZED =
-            ThreePhaseCommitCohortMessages.CanCommitTransactionReply.newBuilder().setCanCommit(true).build();
-
-    private static final ThreePhaseCommitCohortMessages.CanCommitTransactionReply NO_SERIALIZED =
-            ThreePhaseCommitCohortMessages.CanCommitTransactionReply.newBuilder().setCanCommit(false).build();
-
     private boolean canCommit;
 
     public CanCommitTransactionReply() {
@@ -52,15 +46,6 @@ public class CanCommitTransactionReply extends VersionedExternalizableMessage {
         out.writeBoolean(canCommit);
     }
 
-    @Override
-    public Object toSerializable() {
-        if(getVersion() >= DataStoreVersions.BORON_VERSION) {
-            return this;
-        } else {
-            return canCommit ? YES_SERIALIZED : NO_SERIALIZED;
-        }
-    }
-
     @Override
     public String toString() {
         return "CanCommitTransactionReply [canCommit=" + canCommit + ", version=" + getVersion() + "]";
@@ -75,17 +60,11 @@ public class CanCommitTransactionReply extends VersionedExternalizableMessage {
     }
 
     public static CanCommitTransactionReply fromSerializable(final Object serializable) {
-        if(serializable instanceof CanCommitTransactionReply) {
-            return (CanCommitTransactionReply)serializable;
-        } else {
-            ThreePhaseCommitCohortMessages.CanCommitTransactionReply serialized =
-                    (ThreePhaseCommitCohortMessages.CanCommitTransactionReply) serializable;
-            return serialized.getCanCommit() ? YES : NO;
-        }
+        Preconditions.checkArgument(serializable instanceof CanCommitTransactionReply);
+        return (CanCommitTransactionReply)serializable;
     }
 
     public static boolean isSerializedType(Object message) {
-        return message instanceof CanCommitTransactionReply ||
-                message instanceof ThreePhaseCommitCohortMessages.CanCommitTransactionReply;
+        return message instanceof CanCommitTransactionReply;
     }
 }