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%2FPrimaryShardInfo.java;h=1ca06216dd1157a54727ae67c8c8124d2fc0bafa;hb=c9587253579a7b34f4c397a254f83890d4d3ba03;hp=27d247512ca0b37349e0686955d449fc0dcd1dbd;hpb=6a7cc4dcc9909a286dad1267e633af6313bd9059;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryShardInfo.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryShardInfo.java index 27d247512c..1ca06216dd 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryShardInfo.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryShardInfo.java @@ -7,11 +7,12 @@ */ package org.opendaylight.controller.cluster.datastore.messages; +import static java.util.Objects.requireNonNull; + import akka.actor.ActorSelection; -import com.google.common.base.Preconditions; import java.util.Optional; -import javax.annotation.Nonnull; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yangtools.yang.data.api.schema.tree.ReadOnlyDataTree; /** * Local message DTO that contains information about the primary shard. @@ -21,17 +22,17 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; public class PrimaryShardInfo { private final ActorSelection primaryShardActor; private final short primaryShardVersion; - private final DataTree localShardDataTree; + private final ReadOnlyDataTree localShardDataTree; - public PrimaryShardInfo(@Nonnull ActorSelection primaryShardActor, short primaryShardVersion, - @Nonnull DataTree localShardDataTree) { - this.primaryShardActor = Preconditions.checkNotNull(primaryShardActor); + public PrimaryShardInfo(@NonNull ActorSelection primaryShardActor, short primaryShardVersion, + @NonNull ReadOnlyDataTree localShardDataTree) { + this.primaryShardActor = requireNonNull(primaryShardActor); this.primaryShardVersion = primaryShardVersion; - this.localShardDataTree = Preconditions.checkNotNull(localShardDataTree); + this.localShardDataTree = requireNonNull(localShardDataTree); } - public PrimaryShardInfo(@Nonnull ActorSelection primaryShardActor, short primaryShardVersion) { - this.primaryShardActor = Preconditions.checkNotNull(primaryShardActor); + public PrimaryShardInfo(@NonNull ActorSelection primaryShardActor, short primaryShardVersion) { + this.primaryShardActor = requireNonNull(primaryShardActor); this.primaryShardVersion = primaryShardVersion; this.localShardDataTree = null; } @@ -39,7 +40,7 @@ public class PrimaryShardInfo { /** * Returns an ActorSelection representing the primary shard actor. */ - public @Nonnull ActorSelection getPrimaryShardActor() { + public @NonNull ActorSelection getPrimaryShardActor() { return primaryShardActor; } @@ -54,7 +55,7 @@ public class PrimaryShardInfo { * Returns an Optional whose value contains the primary shard's DataTree if the primary shard is local * to the caller. Otherwise the Optional value is absent. */ - public @Nonnull Optional getLocalShardDataTree() { + public @NonNull Optional getLocalShardDataTree() { return Optional.ofNullable(localShardDataTree); } }