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:
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.
| Constructor and Description |
|---|
DegradeRule() |
DegradeRule(String resourceName) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
double |
getCount() |
int |
getGrade() |
AtomicLong |
getPassCount() |
int |
getTimeWindow() |
int |
hashCode() |
boolean |
passCheck(Context context,
DefaultNode node,
int acquireCount,
Object... args)
Check whether current statistical indicators meet this rule, which means not exceeding any threshold.
|
DegradeRule |
setCount(double count) |
DegradeRule |
setGrade(int grade) |
DegradeRule |
setTimeWindow(int timeWindow) |
String |
toString() |
as, getLimitApp, getResource, setLimitApp, setResourcepublic DegradeRule()
public DegradeRule(String resourceName)
public int getGrade()
public DegradeRule setGrade(int grade)
public double getCount()
public DegradeRule setCount(double count)
public AtomicLong getPassCount()
public int getTimeWindow()
public DegradeRule setTimeWindow(int timeWindow)
public boolean equals(Object o)
equals in class AbstractRulepublic int hashCode()
hashCode in class AbstractRulepublic boolean passCheck(Context context, DefaultNode node, int acquireCount, Object... args)
RuleCopyright © 2019 Alibaba Group. All rights reserved.