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=58c1bd6c257af0482676421906be8d813424a9f5;hb=27b9d419798a8d4b673b13c57da6fe31a85e6422;hp=b83b51c874735d3007a9b184433425bb5766e71c;hpb=ecccb6d5b43dd73aef0d2d19349d19ee9b4728f7;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 b83b51c874..58c1bd6c25 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 @@ -23,7 +23,7 @@ public class TransactionRateLimiter { private final ActorContext actorContext; private final long commitTimeoutInSeconds; - private final String dataStoreType; + private final String dataStoreName; private final RateLimiter txRateLimiter; private final AtomicLong acquireCount = new AtomicLong(); @@ -32,7 +32,7 @@ public class TransactionRateLimiter { public TransactionRateLimiter(ActorContext actorContext){ this.actorContext = actorContext; this.commitTimeoutInSeconds = actorContext.getDatastoreContext().getShardTransactionCommitTimeoutInSeconds(); - this.dataStoreType = actorContext.getDataStoreType(); + this.dataStoreName = actorContext.getDataStoreName(); this.txRateLimiter = RateLimiter.create(actorContext.getDatastoreContext().getTransactionCreationInitialRateLimit()); } @@ -65,16 +65,16 @@ public class TransactionRateLimiter { private double getRateLimitFromOtherDataStores(){ // Since we have no rate data for unused Tx's data store, adjust to the rate from another // data store that does have rate data. - for(String datastoreType: DatastoreContext.getGlobalDatastoreTypes()) { - if(datastoreType.equals(this.dataStoreType)) { + for(String name: DatastoreContext.getGlobalDatastoreNames()) { + if(name.equals(this.dataStoreName)) { continue; } - double newRateLimit = calculateNewRateLimit(actorContext.getOperationTimer(datastoreType, ActorContext.COMMIT), + double newRateLimit = calculateNewRateLimit(actorContext.getOperationTimer(name, ActorContext.COMMIT), this.commitTimeoutInSeconds); if(newRateLimit > 0.0) { LOG.debug("On unused Tx - data Store {} commit rateLimit adjusted to {}", - this.dataStoreType, newRateLimit); + this.dataStoreName, newRateLimit); return newRateLimit; }