BUG-2138: Use correct actor context in shard lookup.
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / sharding / ShardedDataTreeActor.java
index 04a75628b7d8d6583b661b27ce71d9f6a7e3ccac..e8f3f708607322706e617c5d1bd28426f058c9af 100644 (file)
@@ -67,6 +67,7 @@ import org.opendaylight.controller.cluster.sharding.messages.PrefixShardRemoved;
 import org.opendaylight.controller.cluster.sharding.messages.ProducerCreated;
 import org.opendaylight.controller.cluster.sharding.messages.ProducerRemoved;
 import org.opendaylight.controller.cluster.sharding.messages.RemovePrefixShard;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeProducer;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeProducerException;
@@ -378,10 +379,14 @@ public class ShardedDataTreeActor extends AbstractUntypedPersistentActor {
 
         replicator.tell(update, self());
 
+        final ActorContext context =
+                configuration.getPrefix().getDatastoreType() == LogicalDatastoreType.CONFIGURATION
+                        ? distributedConfigDatastore.getActorContext() : distributedOperDatastore.getActorContext();
+
         // schedule a notification task for the reply
         actorSystem.scheduler().scheduleOnce(SHARD_LOOKUP_TASK_INTERVAL,
                 new ShardCreationLookupTask(actorSystem, getSender(), clusterWrapper,
-                        actorContext, shardingService, configuration.getPrefix()),
+                        context, shardingService, configuration.getPrefix()),
                 actorSystem.dispatcher());
     }