Refactor odl-mdsal-distributed-datastore
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / LeaderFrontendState.java
index 7611b029ca53a4562753d7346f86db26daef02db..2a1537bd28ab1ca8f91b23da68ce81581af24cf5 100644 (file)
@@ -7,13 +7,13 @@
  */
 package org.opendaylight.controller.cluster.datastore;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.commands.CreateLocalHistoryRequest;
 import org.opendaylight.controller.cluster.access.commands.DeadHistoryException;
 import org.opendaylight.controller.cluster.access.commands.DestroyLocalHistoryRequest;
@@ -37,11 +37,10 @@ import org.slf4j.LoggerFactory;
 
 /**
  * Frontend state as observed by the shard leader. This class is responsible for tracking generations and sequencing
- * in the frontend/backend conversation.
+ * in the frontend/backend conversation. This class is NOT thread-safe.
  *
  * @author Robert Varga
  */
-@NotThreadSafe
 final class LeaderFrontendState implements Identifiable<ClientIdentifier> {
     private static final Logger LOG = LoggerFactory.getLogger(LeaderFrontendState.class);
 
@@ -79,12 +78,12 @@ final class LeaderFrontendState implements Identifiable<ClientIdentifier> {
     LeaderFrontendState(final String persistenceId, final ClientIdentifier clientId, final ShardDataTree tree,
         final UnsignedLongRangeSet purgedHistories, final AbstractFrontendHistory standaloneHistory,
         final Map<LocalHistoryIdentifier, LocalFrontendHistory> localHistories) {
-        this.persistenceId = Preconditions.checkNotNull(persistenceId);
-        this.clientId = Preconditions.checkNotNull(clientId);
-        this.tree = Preconditions.checkNotNull(tree);
-        this.purgedHistories = Preconditions.checkNotNull(purgedHistories);
-        this.standaloneHistory = Preconditions.checkNotNull(standaloneHistory);
-        this.localHistories = Preconditions.checkNotNull(localHistories);
+        this.persistenceId = requireNonNull(persistenceId);
+        this.clientId = requireNonNull(clientId);
+        this.tree = requireNonNull(tree);
+        this.purgedHistories = requireNonNull(purgedHistories);
+        this.standaloneHistory = requireNonNull(standaloneHistory);
+        this.localHistories = requireNonNull(localHistories);
         this.lastSeenTicks = tree.readTime();
     }