Guard against null transaction IDs
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / ForwardedReadyTransaction.java
index 2f48ab9d1be137562f170d354e7580b74e6b7da6..e30d2055c904a63b4d9410f1f3da91d0cd265500 100644 (file)
@@ -7,8 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore.messages;
 
-import org.opendaylight.controller.cluster.datastore.ShardDataTreeCohort;
-import org.opendaylight.controller.cluster.datastore.modification.Modification;
+import com.google.common.base.Preconditions;
+import org.opendaylight.controller.cluster.datastore.ReadWriteShardDataTreeTransaction;
 
 /**
  * Transaction ReadyTransaction message that is forwarded to the local Shard from the ShardTransaction.
@@ -17,18 +17,16 @@ import org.opendaylight.controller.cluster.datastore.modification.Modification;
  */
 public class ForwardedReadyTransaction {
     private final String transactionID;
-    private final ShardDataTreeCohort cohort;
-    private final Modification modification;
+    private final ReadWriteShardDataTreeTransaction transaction;
     private final boolean returnSerialized;
     private final boolean doImmediateCommit;
     private final short txnClientVersion;
 
     public ForwardedReadyTransaction(String transactionID, short txnClientVersion,
-            ShardDataTreeCohort cohort, Modification modification,
-            boolean returnSerialized, boolean doImmediateCommit) {
-        this.transactionID = transactionID;
-        this.cohort = cohort;
-        this.modification = modification;
+            ReadWriteShardDataTreeTransaction transaction, boolean returnSerialized,
+            boolean doImmediateCommit) {
+        this.transactionID = Preconditions.checkNotNull(transactionID);
+        this.transaction = Preconditions.checkNotNull(transaction);
         this.returnSerialized = returnSerialized;
         this.txnClientVersion = txnClientVersion;
         this.doImmediateCommit = doImmediateCommit;
@@ -38,12 +36,8 @@ public class ForwardedReadyTransaction {
         return transactionID;
     }
 
-    public ShardDataTreeCohort getCohort() {
-        return cohort;
-    }
-
-    public Modification getModification() {
-        return modification;
+    public ReadWriteShardDataTreeTransaction getTransaction() {
+        return transaction;
     }
 
     public boolean isReturnSerialized() {