X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fsharding%2FDistributedShardFrontend.java;h=81322cba738a61f0c23fc0bad0ad0f126bd7fdb8;hp=31bc8b6949156662cecdc9a62f116458b589eaad;hb=da174be7e22b16d4ac80cccefdc52b209b700745;hpb=35624f56612e0b8ca641c2fc5fed25f1c7628e51 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFrontend.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFrontend.java index 31bc8b6949..81322cba73 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFrontend.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/DistributedShardFrontend.java @@ -5,19 +5,19 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.cluster.sharding; -import com.google.common.base.Preconditions; +import static com.google.common.base.Preconditions.checkArgument; +import static java.util.Objects.requireNonNull; + import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.annotation.Nonnull; -import javax.annotation.concurrent.GuardedBy; +import org.checkerframework.checker.lock.qual.GuardedBy; import org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient; -import org.opendaylight.controller.cluster.datastore.AbstractDataStore; +import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface; import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener; import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier; import org.opendaylight.mdsal.dom.api.DOMDataTreeShard; @@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory; /** * Proxy implementation of a shard that creates forwarding producers to the backend shard. */ +@Deprecated(forRemoval = true) class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard { private static final Logger LOG = LoggerFactory.getLogger(DistributedShardFrontend.class); @@ -48,21 +49,21 @@ class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard { private final DistributedShardChangePublisher publisher; - DistributedShardFrontend(final AbstractDataStore distributedDataStore, + DistributedShardFrontend(final DistributedDataStoreInterface distributedDataStore, final DataStoreClient client, final DOMDataTreeIdentifier shardRoot) { - this.client = Preconditions.checkNotNull(client); - this.shardRoot = Preconditions.checkNotNull(shardRoot); + this.client = requireNonNull(client); + this.shardRoot = requireNonNull(shardRoot); - publisher = new DistributedShardChangePublisher(client, Preconditions.checkNotNull(distributedDataStore), - shardRoot, childShards); + publisher = new DistributedShardChangePublisher(client, requireNonNull(distributedDataStore), shardRoot, + childShards); } @Override public synchronized DOMDataTreeShardProducer createProducer(final Collection paths) { for (final DOMDataTreeIdentifier prodPrefix : paths) { - Preconditions.checkArgument(shardRoot.contains(prodPrefix), "Prefix %s is not contained under shard root", - prodPrefix, paths); + checkArgument(shardRoot.contains(prodPrefix), "Prefix %s is not contained under shard root", prodPrefix, + paths); } final ShardProxyProducer ret = @@ -74,7 +75,7 @@ class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard { @Override public synchronized void onChildAttached(final DOMDataTreeIdentifier prefix, final DOMDataTreeShard child) { LOG.debug("{} : Child shard attached at {}", shardRoot, prefix); - Preconditions.checkArgument(child != this, "Attempted to attach child %s onto self", this); + checkArgument(child != this, "Attempted to attach child %s onto self", this); addChildShard(prefix, child); updateProducers(); } @@ -88,7 +89,7 @@ class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard { } private void addChildShard(final DOMDataTreeIdentifier prefix, final DOMDataTreeShard child) { - Preconditions.checkArgument(child instanceof WriteableDOMDataTreeShard); + checkArgument(child instanceof WriteableDOMDataTreeShard); childShards.put(prefix, new ChildShardContext(prefix, (WriteableDOMDataTreeShard) child)); } @@ -132,7 +133,6 @@ class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard { } } - @Nonnull @Override public ListenerRegistration registerTreeChangeListener( final YangInstanceIdentifier treeId, final L listener) {