Deprecated controller fine-grained sharding APIs
[controller.git] / opendaylight / md-sal / sal-dom-broker / src / main / java / org / opendaylight / controller / md / sal / dom / broker / impl / ShardedDOMDataTree.java
index c882d5c522f85c4c7675eb33a556f42f0e5b32a0..7af8d2c72026a470a654c914aa4d6b79c039cb43 100644 (file)
@@ -27,6 +27,10 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * @deprecated Use {@link org.opendaylight.mdsal.dom.broker.ShardedDOMDataTree} instead.
+ */
+@Deprecated
 public final class ShardedDOMDataTree implements DOMDataTreeService, DOMDataTreeShardingService {
     private static final Logger LOG = LoggerFactory.getLogger(ShardedDOMDataTree.class);
     private final Map<LogicalDatastoreType, ShardingTableEntry> shardingTables = new EnumMap<>(LogicalDatastoreType.class);
@@ -45,11 +49,7 @@ public final class ShardedDOMDataTree implements DOMDataTreeService, DOMDataTree
 
     @GuardedBy("this")
     private void storeShard(final DOMDataTreeIdentifier prefix, final ShardRegistration<?> reg) {
-        ShardingTableEntry t = shardingTables.get(prefix.getDatastoreType());
-        if (t == null) {
-            t = new ShardingTableEntry();
-            shardingTables.put(prefix.getDatastoreType(), t);
-        }
+        ShardingTableEntry t = shardingTables.computeIfAbsent(prefix.getDatastoreType(), k -> new ShardingTableEntry());
 
         t.store(prefix.getRootIdentifier(), reg);
     }
@@ -100,7 +100,7 @@ public final class ShardedDOMDataTree implements DOMDataTreeService, DOMDataTree
 
             // FIXME: wrap the shard in a proper adaptor based on implemented interface
 
-            reg = new ShardRegistration<T>(this, prefix, shard);
+            reg = new ShardRegistration<>(this, prefix, shard);
 
             storeShard(prefix, reg);
 
@@ -130,7 +130,7 @@ public final class ShardedDOMDataTree implements DOMDataTreeService, DOMDataTree
         for (final DOMDataTreeIdentifier s : producer.getSubtrees()) {
             final DOMDataTreeProducer r = idToProducer.remove(s);
             if (!producer.equals(r)) {
-                LOG.error("Removed producer %s on subtree %s while removing %s", r, s, producer);
+                LOG.error("Removed producer {} on subtree {} while removing {}", r, s, producer);
             }
         }
     }
@@ -139,7 +139,7 @@ public final class ShardedDOMDataTree implements DOMDataTreeService, DOMDataTree
     private DOMDataTreeProducer createProducer(final Map<DOMDataTreeIdentifier, DOMDataTreeShard> shardMap) {
         // Record the producer's attachment points
         final DOMDataTreeProducer ret = ShardedDOMDataTreeProducer.create(this, shardMap);
-        for (final DOMDataTreeIdentifier s : shardMap.keySet()) {
+        for (DOMDataTreeIdentifier s : shardMap.keySet()) {
             idToProducer.put(s, ret);
         }