类 FlowRuleUtil

java.lang.Object
com.alibaba.csp.sentinel.slots.block.flow.FlowRuleUtil

public final class FlowRuleUtil extends Object
从以下版本开始:
1.4.0
作者:
Eric Zhao
  • 方法详细资料

    • buildFlowRuleMap

      public static Map<String,List<FlowRule>> buildFlowRuleMap(List<FlowRule> list)
      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 rules
      filter - 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 rules
      filter - rule filter
      shouldSort - 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 rules
      groupFunction - grouping function of the map (by key)
      filter - rule filter
      shouldSort - whether the rules should be sorted
      返回:
      constructed new flow rule map; empty map if list is null or empty, or no wanted rules
    • validClusterRuleId

      public static boolean validClusterRuleId(Long id)
      Check whether provided ID can be a valid cluster flow ID.
      参数:
      id - flow ID to check
      返回:
      true if valid, otherwise false
    • isValidRule

      public static boolean isValidRule(FlowRule rule)
      Check whether provided flow rule is valid.
      参数:
      rule - flow rule to check
      返回:
      true if valid, otherwise false
    • checkClusterConcurrentField

      public static boolean checkClusterConcurrentField(FlowRule rule)
    • isWindowConfigValid

      public static boolean isWindowConfigValid(int sampleCount, int windowIntervalMs)