Rename ActorContext to ActorUtils
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / utils / TransactionRateLimiter.java
index 32faf3a00b02d24cf8fe4c446666cae867fceee4..f242a650d4479922daa9a7a36a78f3548753bd66 100644 (file)
@@ -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 {}",