Commit c56e11f1 by Nepxion

修复本地和远程规则文件全部缺失的情况下,抛空指针异常

parent d0a755b4
......@@ -36,6 +36,10 @@ public abstract class PredicateBasedRuleDecorator extends PredicateBasedRule {
@Override
public Server choose(Object key) {
WeightFilterEntity weightFilterEntity = weightRandomLoadBalance.getWeightFilterEntity();
if (weightFilterEntity == null) {
return super.choose(key);
}
if (!weightFilterEntity.hasWeight()) {
return super.choose(key);
}
......
......@@ -36,6 +36,10 @@ public class ZoneAvoidanceRuleDecorator extends ZoneAvoidanceRule {
@Override
public Server choose(Object key) {
WeightFilterEntity weightFilterEntity = weightRandomLoadBalance.getWeightFilterEntity();
if (weightFilterEntity == null) {
return super.choose(key);
}
if (!weightFilterEntity.hasWeight()) {
return super.choose(key);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment