java.lang.Object
com.alibaba.csp.sentinel.slots.block.AbstractRule
com.alibaba.csp.sentinel.slots.block.degrade.DegradeRule
所有已实现的接口:
Rule

public class DegradeRule extends AbstractRule

Degrade is used when the resources are in an unstable state, these resources will be degraded within the next defined time window. There are two ways to measure whether a resource is stable or not:

  • Average response time (DEGRADE_GRADE_RT): When the average RT exceeds the threshold ('count' in 'DegradeRule', in milliseconds), the resource enters a quasi-degraded state. If the RT of next coming 5 requests still exceed this threshold, this resource will be downgraded, which means that in the next time window (defined in 'timeWindow', in seconds) all the access to this resource will be blocked.
  • Exception ratio: When the ratio of exception count per second and the success qps exceeds the threshold, access to the resource will be blocked in the coming window.
作者:
jialiang.linjl, Eric Zhao
  • 构造器详细资料

    • DegradeRule

      public DegradeRule()
    • DegradeRule

      public DegradeRule(String resourceName)
  • 方法详细资料

    • getGrade

      public int getGrade()
    • setGrade

      public DegradeRule setGrade(int grade)
    • getCount

      public double getCount()
    • setCount

      public DegradeRule setCount(double count)
    • getTimeWindow

      public int getTimeWindow()
    • setTimeWindow

      public DegradeRule setTimeWindow(int timeWindow)
    • getMinRequestAmount

      public int getMinRequestAmount()
    • setMinRequestAmount

      public DegradeRule setMinRequestAmount(int minRequestAmount)
    • getSlowRatioThreshold

      public double getSlowRatioThreshold()
    • setSlowRatioThreshold

      public DegradeRule setSlowRatioThreshold(double slowRatioThreshold)
    • getStatIntervalMs

      public int getStatIntervalMs()
    • setStatIntervalMs

      public DegradeRule setStatIntervalMs(int statIntervalMs)
    • equals

      public boolean equals(Object o)
      覆盖:
      equals 在类中 AbstractRule
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 AbstractRule
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object