|
|
@@ -100,7 +100,7 @@ public class DegradeRule extends AbstractRule { |
|
|
|
return cut; |
|
|
|
} |
|
|
|
|
|
|
|
public void setCut(boolean cut) { |
|
|
|
private void setCut(boolean cut) { |
|
|
|
this.cut = cut; |
|
|
|
} |
|
|
|
|
|
|
@@ -108,10 +108,6 @@ public class DegradeRule extends AbstractRule { |
|
|
|
return passCount; |
|
|
|
} |
|
|
|
|
|
|
|
public void setPassCount(AtomicLong passCount) { |
|
|
|
this.passCount = passCount; |
|
|
|
} |
|
|
|
|
|
|
|
public int getTimeWindow() { |
|
|
|
return timeWindow; |
|
|
|
} |
|
|
@@ -143,12 +139,6 @@ public class DegradeRule extends AbstractRule { |
|
|
|
if (grade != that.grade) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
// if (cut != that.cut) { return false; } |
|
|
|
//// AtomicLong dose not Override equals() |
|
|
|
// if ((passCount == null && that.passCount != null) |
|
|
|
// || (passCount.get() != that.passCount.get())) { |
|
|
|
// return false; |
|
|
|
// } |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
@@ -158,9 +148,6 @@ public class DegradeRule extends AbstractRule { |
|
|
|
result = 31 * result + new Double(count).hashCode(); |
|
|
|
result = 31 * result + timeWindow; |
|
|
|
result = 31 * result + grade; |
|
|
|
// result = 31 * result + (cut ? 1 : 0); |
|
|
|
// result = 31 * result + (passCount != null ? (int)passCount.get() : |
|
|
|
// 0); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
@@ -179,6 +166,7 @@ public class DegradeRule extends AbstractRule { |
|
|
|
if (grade == RuleConstant.DEGRADE_GRADE_RT) { |
|
|
|
double rt = clusterNode.avgRt(); |
|
|
|
if (rt < this.count) { |
|
|
|
passCount.set(0); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
@@ -189,11 +177,17 @@ public class DegradeRule extends AbstractRule { |
|
|
|
} else { |
|
|
|
double exception = clusterNode.exceptionQps(); |
|
|
|
double success = clusterNode.successQps(); |
|
|
|
if (success == 0) { |
|
|
|
long total = clusterNode.totalQps(); |
|
|
|
// if total qps less than RT_MAX_EXCEED_N, pass. |
|
|
|
if (total < RT_MAX_EXCEED_N) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
if (exception / success < count) { |
|
|
|
if (success == 0) { |
|
|
|
return exception < RT_MAX_EXCEED_N; |
|
|
|
} |
|
|
|
|
|
|
|
if (exception / (success + exception) < count) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|