public abstract class AbstractCircuitBreaker extends Object implements CircuitBreaker
CircuitBreaker.State| Modifier and Type | Field and Description |
|---|---|
protected AtomicReference<CircuitBreaker.State> |
currentState |
protected long |
nextRetryTimestamp |
protected int |
recoveryTimeoutMs |
protected DegradeRule |
rule |
| Constructor and Description |
|---|
AbstractCircuitBreaker(DegradeRule rule) |
| Modifier and Type | Method and Description |
|---|---|
CircuitBreaker.State |
currentState()
Get current state of the circuit breaker.
|
protected boolean |
fromCloseToOpen(double snapshotValue) |
protected boolean |
fromHalfOpenToClose() |
protected boolean |
fromHalfOpenToOpen(double snapshotValue) |
protected boolean |
fromOpenToHalfOpen(Context context) |
DegradeRule |
getRule()
Get the associated circuit breaking rule.
|
protected boolean |
retryTimeoutArrived() |
protected void |
transformToOpen(double triggerValue) |
boolean |
tryPass(Context context)
Acquires permission of an invocation only if it is available at the time of invoking.
|
protected void |
updateNextRetryTimestamp() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonRequestCompleteprotected final DegradeRule rule
protected final int recoveryTimeoutMs
protected final AtomicReference<CircuitBreaker.State> currentState
protected volatile long nextRetryTimestamp
public AbstractCircuitBreaker(DegradeRule rule)
public DegradeRule getRule()
CircuitBreakergetRule in interface CircuitBreakerpublic CircuitBreaker.State currentState()
CircuitBreakercurrentState in interface CircuitBreakerpublic boolean tryPass(Context context)
CircuitBreakertryPass in interface CircuitBreakercontext - context of current invocationtrue if permission was acquired and false otherwiseprotected boolean retryTimeoutArrived()
protected void updateNextRetryTimestamp()
protected boolean fromCloseToOpen(double snapshotValue)
protected boolean fromOpenToHalfOpen(Context context)
protected boolean fromHalfOpenToOpen(double snapshotValue)
protected boolean fromHalfOpenToClose()
protected void transformToOpen(double triggerValue)
Copyright © 2021 Alibaba Group. All rights reserved.