X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Futils%2FTransactionRateLimiter.java;h=f242a650d4479922daa9a7a36a78f3548753bd66;hb=72d71d1cded60bcac65296211272754006b3f89a;hp=32faf3a00b02d24cf8fe4c446666cae867fceee4;hpb=925cb4a228d0fda99c7bfeb432eb25285a223887;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/TransactionRateLimiter.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/TransactionRateLimiter.java index 32faf3a00b..f242a650d4 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/TransactionRateLimiter.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/TransactionRateLimiter.java @@ -21,7 +21,7 @@ import org.slf4j.LoggerFactory; public class TransactionRateLimiter { private static final Logger LOG = LoggerFactory.getLogger(TransactionRateLimiter.class); - private final ActorContext actorContext; + private final ActorUtils actorUtils; private final long commitTimeoutInSeconds; private final String dataStoreName; private final RateLimiter txRateLimiter; @@ -29,11 +29,11 @@ public class TransactionRateLimiter { private volatile long pollOnCount = 1; - public TransactionRateLimiter(ActorContext actorContext) { - this.actorContext = actorContext; - this.commitTimeoutInSeconds = actorContext.getDatastoreContext().getShardTransactionCommitTimeoutInSeconds(); - this.dataStoreName = actorContext.getDataStoreName(); - this.txRateLimiter = RateLimiter.create(actorContext.getDatastoreContext() + public TransactionRateLimiter(ActorUtils actorUtils) { + this.actorUtils = actorUtils; + this.commitTimeoutInSeconds = actorUtils.getDatastoreContext().getShardTransactionCommitTimeoutInSeconds(); + this.dataStoreName = actorUtils.getDataStoreName(); + this.txRateLimiter = RateLimiter.create(actorUtils.getDatastoreContext() .getTransactionCreationInitialRateLimit()); } @@ -45,7 +45,7 @@ public class TransactionRateLimiter { private void adjustRateLimit() { final long count = acquireCount.incrementAndGet(); if (count >= pollOnCount) { - final Timer commitTimer = actorContext.getOperationTimer(ActorContext.COMMIT); + final Timer commitTimer = actorUtils.getOperationTimer(ActorUtils.COMMIT); double newRateLimit = calculateNewRateLimit(commitTimer, commitTimeoutInSeconds); if (newRateLimit < 1.0) { @@ -71,7 +71,7 @@ public class TransactionRateLimiter { continue; } - double newRateLimit = calculateNewRateLimit(actorContext.getOperationTimer(name, ActorContext.COMMIT), + double newRateLimit = calculateNewRateLimit(actorUtils.getOperationTimer(name, ActorUtils.COMMIT), this.commitTimeoutInSeconds); if (newRateLimit > 0.0) { LOG.debug("On unused Tx - data Store {} commit rateLimit adjusted to {}",