BUG 2676 : Apply backpressure when creating transactions
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / DistributedDataStore.java
index 930c5f7257dc6c061f23f54868a55f8da68b4acb..e9038ed4f0f9ab5a37af554ef43215af8668e6c8 100644 (file)
@@ -54,7 +54,7 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au
         actorContext = new ActorContext(actorSystem, actorSystem.actorOf(
                 ShardManager.props(type, cluster, configuration, datastoreContext)
                     .withMailbox(ActorContext.MAILBOX), shardManagerId ),
-                cluster, configuration, datastoreContext);
+                cluster, configuration, datastoreContext, type);
     }
 
     public DistributedDataStore(ActorContext actorContext) {
@@ -94,11 +94,13 @@ public class DistributedDataStore implements DOMStore, SchemaContextListener, Au
 
     @Override
     public DOMStoreWriteTransaction newWriteOnlyTransaction() {
+        actorContext.acquireTxCreationPermit();
         return new TransactionProxy(actorContext, TransactionProxy.TransactionType.WRITE_ONLY);
     }
 
     @Override
     public DOMStoreReadWriteTransaction newReadWriteTransaction() {
+        actorContext.acquireTxCreationPermit();
         return new TransactionProxy(actorContext, TransactionProxy.TransactionType.READ_WRITE);
     }