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%2Fsharding%2FDistributedShardFrontend.java;h=31bc8b6949156662cecdc9a62f116458b589eaad;hb=b712eb01354ddb5878008e2a2e8f03fb19b92555;hp=f6060a89fda05ab2972b965687c9694fed552d60;hpb=149feb98f151186975fe42bab5853e05aafd4b51;p=controller.git 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 f6060a89fd..31bc8b6949 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 @@ -17,7 +17,7 @@ import java.util.Map; import javax.annotation.Nonnull; import javax.annotation.concurrent.GuardedBy; import org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient; -import org.opendaylight.controller.cluster.datastore.DistributedDataStore; +import org.opendaylight.controller.cluster.datastore.AbstractDataStore; import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeListener; import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier; import org.opendaylight.mdsal.dom.api.DOMDataTreeShard; @@ -48,7 +48,7 @@ class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard { private final DistributedShardChangePublisher publisher; - DistributedShardFrontend(final DistributedDataStore distributedDataStore, + DistributedShardFrontend(final AbstractDataStore distributedDataStore, final DataStoreClient client, final DOMDataTreeIdentifier shardRoot) { this.client = Preconditions.checkNotNull(client); @@ -108,11 +108,8 @@ class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard { continue; } - SubshardProducerSpecification spec = affectedSubshards.get(maybeAffected.getPrefix()); - if (spec == null) { - spec = new SubshardProducerSpecification(maybeAffected); - affectedSubshards.put(maybeAffected.getPrefix(), spec); - } + SubshardProducerSpecification spec = affectedSubshards.computeIfAbsent(maybeAffected.getPrefix(), + k -> new SubshardProducerSpecification(maybeAffected)); spec.addPrefix(bindPath); } } @@ -137,7 +134,6 @@ class DistributedShardFrontend implements ReadableWriteableDOMDataTreeShard { @Nonnull @Override - @SuppressWarnings("unchecked") public ListenerRegistration registerTreeChangeListener( final YangInstanceIdentifier treeId, final L listener) { return publisher.registerTreeChangeListener(treeId, listener);