List of usage examples for com.google.common.util.concurrent RateLimiterCreator createBurstingLimiter
public static RateLimiter createBurstingLimiter(double rate, double burstBucketSizeInSeconds)
From source file:com.amazon.janusgraph.diskstorage.dynamodb.Client.java
private void setupStore(org.janusgraph.diskstorage.configuration.Configuration config, String prefix, final Map<String, RateLimiter> readRateLimit, final Map<String, RateLimiter> writeRateLimit, String store) {// www. j a va 2s .co m final String dataModel = config.get(Constants.STORES_DATA_MODEL, store); final int scanLimit = config.get(Constants.STORES_SCAN_LIMIT, store); final long readCapacity = config.get(Constants.STORES_INITIAL_CAPACITY_READ, store); final long writeCapacity = config.get(Constants.STORES_INITIAL_CAPACITY_WRITE, store); final double readRate = config.get(Constants.STORES_READ_RATE_LIMIT, store); final double writeRate = config.get(Constants.STORES_WRITE_RATE_LIMIT, store); String actualTableName = prefix + "_" + store; this.dataModel.put(store, BackendDataModel.valueOf(dataModel)); this.capacityRead.put(actualTableName, readCapacity); this.capacityWrite.put(actualTableName, writeCapacity); readRateLimit.put(actualTableName, RateLimiterCreator.createBurstingLimiter(readRate, DEFAULT_BURST_BUCKET_SIZE_IN_SECONDS)); writeRateLimit.put(actualTableName, RateLimiterCreator.createBurstingLimiter(writeRate, DEFAULT_BURST_BUCKET_SIZE_IN_SECONDS)); this.scanLimit.put(actualTableName, scanLimit); }