Skip to content

Commit

Permalink
Fixes alibaba#14: Apply Alibaba Java Coding Guidelines
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Zhao <[email protected]>
  • Loading branch information
sczyh30 committed Jul 31, 2018
1 parent bc620d6 commit b113219
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public class WarmUpController implements Controller {
private int maxToken;
private double slope;

AtomicLong storedTokens = new AtomicLong(0);
AtomicLong lastFilledTime = new AtomicLong(0);
private AtomicLong storedTokens = new AtomicLong(0);
private AtomicLong lastFilledTime = new AtomicLong(0);

public WarmUpController(double count, int warmupPeriodInSec, int coldFactor) {
construct(count, warmupPeriodInSec, coldFactor);
Expand All @@ -83,7 +83,7 @@ public WarmUpController(double count, int warmUpPeriodInMic) {
private void construct(double count, int warmUpPeriodInSec, int coldFactor) {

if (coldFactor <= 1) {
throw new RuntimeException("cold factor should be larget than 1");
throw new IllegalArgumentException("Cold factor should be larger than 1");
}

this.count = count;
Expand Down Expand Up @@ -146,7 +146,7 @@ private void syncToken(long passQps) {
if (storedTokens.compareAndSet(oldValue, newValue)) {
long currentValue = storedTokens.addAndGet(0 - passQps);
if (currentValue < 0) {
storedTokens.set(0l);
storedTokens.set(0L);
}
lastFilledTime.set(currentTime);
}
Expand Down

0 comments on commit b113219

Please sign in to comment.