Bug 8301: Fix some issues with testProducerRegistrations
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / sharding / DistributedShardedDOMDataTree.java
index 424439f6e58bbc62e28e914514b6f23516771f1f..54b33a4ccdfe17ed479f32000cbbc3346b3cb3fd 100644 (file)
@@ -464,8 +464,9 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
 
     DOMDataTreePrefixTableEntry<DOMDataTreeShardRegistration<DOMDataTreeShard>> lookupShardFrontend(
             final DOMDataTreeIdentifier prefix) {
-        return shards.lookup(prefix);
-
+        synchronized (shards) {
+            return shards.lookup(prefix);
+        }
     }
 
     DOMDataTreeProducer localCreateProducer(final Collection<DOMDataTreeIdentifier> prefix) {
@@ -675,7 +676,7 @@ public class DistributedShardedDOMDataTree implements DOMDataTreeService, DOMDat
 
             final Object o = actorContext.executeOperation(shardDataTreeActor, new ProducerRemoved(subtrees));
             if (o instanceof DOMDataTreeProducerException) {
-                throw ((DOMDataTreeProducerException) o);
+                throw (DOMDataTreeProducerException) o;
             } else if (o instanceof Throwable) {
                 throw new DOMDataTreeProducerException("Unable to close producer", (Throwable) o);
             }