Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed some unnecessary functions in DynamicEventThrottler

  • Loading branch information...
commit fde488a69dd512a629c59033e632e8312381e016 1 parent 4e41b6a
Chinmay Soman authored
4 contrib/hadoop-store-builder/src/java/voldemort/store/readonly/fetcher/HdfsFetcher.java
View
@@ -111,9 +111,10 @@ public HdfsFetcher(DynamicThrottleLimit dynThrottleLimit,
Long reportingIntervalBytes,
int bufferSize,
long minBytesPerSecond) {
- if(dynThrottleLimit != null) {
+ if(dynThrottleLimit != null && dynThrottleLimit.getRate() != 0) {
this.maxBytesPerSecond = dynThrottleLimit.getRate();
this.throttler = new DynamicEventThrottler(dynThrottleLimit);
+ this.globalThrottleLimit = dynThrottleLimit;
logger.info("Initializing Dynamic Event throttler with rate : "
+ this.maxBytesPerSecond + " bytes / sec");
} else
@@ -122,7 +123,6 @@ public HdfsFetcher(DynamicThrottleLimit dynThrottleLimit,
this.bufferSize = bufferSize;
this.status = null;
this.minBytesPerSecond = minBytesPerSecond;
- this.globalThrottleLimit = dynThrottleLimit;
}
public File fetch(String sourceFileUrl, String destinationFile) throws IOException {
10 src/java/voldemort/utils/DynamicEventThrottler.java
View
@@ -20,18 +20,10 @@ public DynamicEventThrottler(Time time, long ratePerSecond, long intervalMs) {
super(time, ratePerSecond, intervalMs);
}
- public void updateRate(long l) {
+ public synchronized void updateRate(long l) {
this.dynamicRatePerSecond = l;
}
- public void incrementNumJobs() {
- this.dynThrottleLimit.incrementNumJobs();
- }
-
- public void decrementNumJobs() {
- this.dynThrottleLimit.decrementNumJobs();
- }
-
@Override
public long getRate() {
if(this.dynThrottleLimit != null)
6 src/java/voldemort/utils/DynamicThrottleLimit.java
View
@@ -14,11 +14,7 @@ public DynamicThrottleLimit(long val) {
}
public long getRate() {
- long retVal;
- synchronized(this) {
- retVal = this.dynamicRatePerSecond;
- }
- return retVal;
+ return this.dynamicRatePerSecond;
}
public void incrementNumJobs() {
Please sign in to comment.
Something went wrong with that request. Please try again.