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=3f2f311927a45635339201f400652c145318e632;hp=f739e1e6c4ab66de3f958f5c39d98a241e8b9f04;hpb=8232a626b43fdd2f5799da0fbcfb0f02d3c8f4fb;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 f739e1e6c4..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,8 +40,7 @@ public class PrimaryShardInfo { /** * Returns an ActorSelection representing the primary shard actor. */ - @Nonnull - public ActorSelection getPrimaryShardActor() { + public @NonNull ActorSelection getPrimaryShardActor() { return primaryShardActor; } @@ -55,8 +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. */ - @Nonnull - public Optional getLocalShardDataTree() { + public @NonNull Optional getLocalShardDataTree() { return Optional.ofNullable(localShardDataTree); } }