Merge "Install snapshot and Reply"
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / DistributedDataStore.java
index 51f3735f81ee6a9f4a5ad192cb6d1f1c27ebd031..0a137e07df43a1bb7ca2fb3e854d7f63adfd46a3 100644 (file)
@@ -46,7 +46,7 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au
     private static final Logger LOG = LoggerFactory.getLogger(DistributedDataStore.class);
 
     private final ActorContext actorContext;
-    private final ShardContext shardContext;
+    private final DatastoreContext datastoreContext;
 
     public DistributedDataStore(ActorSystem actorSystem, String type, ClusterWrapper cluster,
             Configuration configuration, DistributedDataStoreProperties dataStoreProperties) {
@@ -60,21 +60,25 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au
 
         LOG.info("Creating ShardManager : {}", shardManagerId);
 
-        shardContext = new ShardContext(InMemoryDOMDataStoreConfigProperties.create(
+        datastoreContext = new DatastoreContext(InMemoryDOMDataStoreConfigProperties.create(
                 dataStoreProperties.getMaxShardDataChangeExecutorPoolSize(),
                 dataStoreProperties.getMaxShardDataChangeExecutorQueueSize(),
                 dataStoreProperties.getMaxShardDataChangeListenerQueueSize()),
                 Duration.create(dataStoreProperties.getShardTransactionIdleTimeoutInMinutes(),
                         TimeUnit.MINUTES));
 
-        actorContext = new ActorContext(actorSystem, actorSystem
-            .actorOf(ShardManager.props(type, cluster, configuration, shardContext),
-                shardManagerId ), cluster, configuration);
+        actorContext
+                = new ActorContext(
+                    actorSystem, actorSystem.actorOf(
+                        ShardManager.props(type, cluster, configuration, datastoreContext).
+                            withMailbox(ActorContext.MAILBOX), shardManagerId ), cluster, configuration);
+
+        actorContext.setOperationTimeout(dataStoreProperties.getOperationTimeoutInSeconds());
     }
 
     public DistributedDataStore(ActorContext actorContext) {
         this.actorContext = Preconditions.checkNotNull(actorContext, "actorContext should not be null");
-        this.shardContext = new ShardContext();
+        this.datastoreContext = new DatastoreContext();
     }
 
 
@@ -96,8 +100,7 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au
         String shardName = ShardStrategyFactory.getStrategy(path).findShard(path);
 
         Object result = actorContext.executeLocalShardOperation(shardName,
-            new RegisterChangeListener(path, dataChangeListenerActor.path(), scope),
-            ActorContext.ASK_DURATION);
+            new RegisterChangeListener(path, dataChangeListenerActor.path(), scope));
 
         if (result != null) {
             RegisterChangeListenerReply reply = (RegisterChangeListenerReply) result;