Browse Source

Fixes #14: Apply Alibaba Java Coding Guidelines

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
master
Eric Zhao 6 years ago
parent
commit
b113219c27
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/block/flow/controller/WarmUpController.java

+ 4
- 4
sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/block/flow/controller/WarmUpController.java View File

@@ -69,8 +69,8 @@ public class WarmUpController implements Controller {
private int maxToken; private int maxToken;
private double slope; 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) { public WarmUpController(double count, int warmupPeriodInSec, int coldFactor) {
construct(count, warmupPeriodInSec, coldFactor); construct(count, warmupPeriodInSec, coldFactor);
@@ -83,7 +83,7 @@ public class WarmUpController implements Controller {
private void construct(double count, int warmUpPeriodInSec, int coldFactor) { private void construct(double count, int warmUpPeriodInSec, int coldFactor) {


if (coldFactor <= 1) { 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; this.count = count;
@@ -146,7 +146,7 @@ public class WarmUpController implements Controller {
if (storedTokens.compareAndSet(oldValue, newValue)) { if (storedTokens.compareAndSet(oldValue, newValue)) {
long currentValue = storedTokens.addAndGet(0 - passQps); long currentValue = storedTokens.addAndGet(0 - passQps);
if (currentValue < 0) { if (currentValue < 0) {
storedTokens.set(0l);
storedTokens.set(0L);
} }
lastFilledTime.set(currentTime); lastFilledTime.set(currentTime);
} }


Loading…
Cancel
Save