Package org.opensearch.common.breaker
Class NoopCircuitBreaker
java.lang.Object
org.opensearch.common.breaker.NoopCircuitBreaker
- All Implemented Interfaces:
CircuitBreaker
A CircuitBreaker that doesn't increment or adjust, and all operations are
basically noops
- Opensearch.internal:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensearch.common.breaker.CircuitBreaker
CircuitBreaker.Durability, CircuitBreaker.Type
-
Field Summary
FieldsFields inherited from interface org.opensearch.common.breaker.CircuitBreaker
FIELDDATA, IN_FLIGHT_REQUESTS, PARENT, REQUEST
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
addEstimateBytesAndMaybeBreak
(long bytes, String label) add bytes to the breaker and maybe triplong
addWithoutBreaking
(long bytes) Adjust the circuit breaker without trippingvoid
circuitBreak
(String fieldName, long bytesNeeded) Trip the circuit breakerlong
getLimit()
getName()
double
long
long
getUsed()
void
setLimitAndOverhead
(long limit, double overhead) sets the new limit and overhead values for the circuit breaker.
-
Field Details
-
LIMIT
public static final int LIMIT- See Also:
-
-
Constructor Details
-
NoopCircuitBreaker
-
-
Method Details
-
circuitBreak
Description copied from interface:CircuitBreaker
Trip the circuit breaker- Specified by:
circuitBreak
in interfaceCircuitBreaker
- Parameters:
fieldName
- name of the field responsible for tripping the breakerbytesNeeded
- bytes asked for but unable to be allocated
-
addEstimateBytesAndMaybeBreak
public double addEstimateBytesAndMaybeBreak(long bytes, String label) throws CircuitBreakingException Description copied from interface:CircuitBreaker
add bytes to the breaker and maybe trip- Specified by:
addEstimateBytesAndMaybeBreak
in interfaceCircuitBreaker
- Parameters:
bytes
- number of bytes to addlabel
- string label describing the bytes being added- Returns:
- the number of "used" bytes for the circuit breaker
- Throws:
CircuitBreakingException
-
addWithoutBreaking
public long addWithoutBreaking(long bytes) Description copied from interface:CircuitBreaker
Adjust the circuit breaker without tripping- Specified by:
addWithoutBreaking
in interfaceCircuitBreaker
-
getUsed
public long getUsed()- Specified by:
getUsed
in interfaceCircuitBreaker
- Returns:
- the currently used bytes the breaker is tracking
-
getLimit
public long getLimit()- Specified by:
getLimit
in interfaceCircuitBreaker
- Returns:
- maximum number of bytes the circuit breaker can track before tripping
-
getOverhead
public double getOverhead()- Specified by:
getOverhead
in interfaceCircuitBreaker
- Returns:
- overhead of circuit breaker
-
getTrippedCount
public long getTrippedCount()- Specified by:
getTrippedCount
in interfaceCircuitBreaker
- Returns:
- the number of times the circuit breaker has been tripped
-
getName
- Specified by:
getName
in interfaceCircuitBreaker
- Returns:
- the name of the breaker
-
getDurability
- Specified by:
getDurability
in interfaceCircuitBreaker
- Returns:
- whether a tripped circuit breaker will reset itself (transient) or requires manual intervention (permanent).
-
setLimitAndOverhead
public void setLimitAndOverhead(long limit, double overhead) Description copied from interface:CircuitBreaker
sets the new limit and overhead values for the circuit breaker. The resulting write should be readable by other threads.- Specified by:
setLimitAndOverhead
in interfaceCircuitBreaker
- Parameters:
limit
- the desired limitoverhead
- the desired overhead constant
-