类 FlowRuleUtil
java.lang.Object
com.alibaba.csp.sentinel.slots.block.flow.FlowRuleUtil
- 从以下版本开始:
- 1.4.0
- 作者:
- Eric Zhao
-
方法概要
修饰符和类型方法说明buildFlowRuleMap(List<FlowRule> list) Build the flow rule map from raw list of flow rules, grouping by resource name.buildFlowRuleMap(List<FlowRule> list, Function<FlowRule, K> groupFunction, Predicate<FlowRule> filter, boolean shouldSort) Build the flow rule map from raw list of flow rules, grouping by provided group function.buildFlowRuleMap(List<FlowRule> list, Predicate<FlowRule> filter) Build the flow rule map from raw list of flow rules, grouping by resource name.buildFlowRuleMap(List<FlowRule> list, Predicate<FlowRule> filter, boolean shouldSort) Build the flow rule map from raw list of flow rules, grouping by resource name.static booleanstatic booleanisValidRule(FlowRule rule) Check whether provided flow rule is valid.static booleanisWindowConfigValid(int sampleCount, int windowIntervalMs) static booleanCheck whether provided ID can be a valid cluster flow ID.
-
方法详细资料
-
buildFlowRuleMap
Build the flow rule map from raw list of flow rules, grouping by resource name.- 参数:
list- raw list of flow rules- 返回:
- constructed new flow rule map; empty map if list is null or empty, or no valid rules
-
buildFlowRuleMap
public static Map<String,List<FlowRule>> buildFlowRuleMap(List<FlowRule> list, Predicate<FlowRule> filter) Build the flow rule map from raw list of flow rules, grouping by resource name.- 参数:
list- raw list of flow rulesfilter- rule filter- 返回:
- constructed new flow rule map; empty map if list is null or empty, or no wanted rules
-
buildFlowRuleMap
public static Map<String,List<FlowRule>> buildFlowRuleMap(List<FlowRule> list, Predicate<FlowRule> filter, boolean shouldSort) Build the flow rule map from raw list of flow rules, grouping by resource name.- 参数:
list- raw list of flow rulesfilter- rule filtershouldSort- whether the rules should be sorted- 返回:
- constructed new flow rule map; empty map if list is null or empty, or no wanted rules
-
buildFlowRuleMap
public static <K> Map<K,List<FlowRule>> buildFlowRuleMap(List<FlowRule> list, Function<FlowRule, K> groupFunction, Predicate<FlowRule> filter, boolean shouldSort) Build the flow rule map from raw list of flow rules, grouping by provided group function.- 类型参数:
K- type of key- 参数:
list- raw list of flow rulesgroupFunction- grouping function of the map (by key)filter- rule filtershouldSort- whether the rules should be sorted- 返回:
- constructed new flow rule map; empty map if list is null or empty, or no wanted rules
-
validClusterRuleId
Check whether provided ID can be a valid cluster flow ID.- 参数:
id- flow ID to check- 返回:
- true if valid, otherwise false
-
isValidRule
Check whether provided flow rule is valid.- 参数:
rule- flow rule to check- 返回:
- true if valid, otherwise false
-
checkClusterConcurrentField
-
isWindowConfigValid
public static boolean isWindowConfigValid(int sampleCount, int windowIntervalMs)
-