Sprinkle @NonNull annotations
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / concepts / TransactionIdentifier.java
index 202b5ce6dc53fbe2b3946727b419f3d928d27b1c..d2a92ea1913374a2dfa693195f27f1916938d347 100644 (file)
@@ -7,15 +7,16 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 import org.opendaylight.yangtools.concepts.WritableObjects;
 
@@ -39,7 +40,7 @@ public final class TransactionIdentifier implements WritableIdentifier {
         }
 
         Proxy(final LocalHistoryIdentifier historyId, final long transactionId) {
-            this.historyId = Preconditions.checkNotNull(historyId);
+            this.historyId = requireNonNull(historyId);
             this.transactionId = transactionId;
         }
 
@@ -61,16 +62,16 @@ public final class TransactionIdentifier implements WritableIdentifier {
     }
 
     private static final long serialVersionUID = 1L;
-    private final LocalHistoryIdentifier historyId;
+    private final @NonNull LocalHistoryIdentifier historyId;
     private final long transactionId;
-    private transient String shortString;
+    private String shortString;
 
-    public TransactionIdentifier(@Nonnull final LocalHistoryIdentifier historyId, final long transactionId) {
-        this.historyId = Preconditions.checkNotNull(historyId);
+    public TransactionIdentifier(final @NonNull LocalHistoryIdentifier historyId, final long transactionId) {
+        this.historyId = requireNonNull(historyId);
         this.transactionId = transactionId;
     }
 
-    public static TransactionIdentifier readFrom(final DataInput in) throws IOException {
+    public static @NonNull TransactionIdentifier readFrom(final DataInput in) throws IOException {
         final LocalHistoryIdentifier historyId = LocalHistoryIdentifier.readFrom(in);
         return new TransactionIdentifier(historyId, WritableObjects.readLong(in));
     }
@@ -81,7 +82,7 @@ public final class TransactionIdentifier implements WritableIdentifier {
         WritableObjects.writeLong(out, transactionId);
     }
 
-    public LocalHistoryIdentifier getHistoryId() {
+    public @NonNull LocalHistoryIdentifier getHistoryId() {
         return historyId;
     }
 
@@ -112,7 +113,8 @@ public final class TransactionIdentifier implements WritableIdentifier {
             String histStr = historyId.getHistoryId() == 0 ? "" : "-chn-" + historyId.getHistoryId();
             shortString = historyId.getClientId().getFrontendId().getMemberName().getName() + "-"
                     + historyId.getClientId().getFrontendId().getClientType().getName() + "-fe-"
-                    + historyId.getClientId().getGeneration() + histStr + "-txn-" + transactionId;
+                    + historyId.getClientId().getGeneration() + histStr + "-txn-" + transactionId
+                    + "-" + historyId.getCookie();
         }
 
         return shortString;