Class NoopCircuitBreaker
java.lang.Object
org.opensearch.core.common.breaker.NoopCircuitBreaker
- All Implemented Interfaces:
CircuitBreaker
A
CircuitBreaker that doesn't increment or adjust, and all operations are
basically noops.
It never trips, limit is always -1, always returns 0 for all metrics.- Opensearch.internal:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensearch.core.common.breaker.CircuitBreaker
CircuitBreaker.Durability, CircuitBreaker.Type -
Field Summary
FieldsFields inherited from interface org.opensearch.core.common.breaker.CircuitBreaker
FIELDDATA, IN_FLIGHT_REQUESTS, PARENT, REQUEST -
Constructor Summary
ConstructorsConstructorDescriptionNoopCircuitBreaker(String name) Creates a new NoopCircuitBreaker (that never trip) with the given name -
Method Summary
Modifier and TypeMethodDescriptiondoubleaddEstimateBytesAndMaybeBreak(long bytes, String label) This is a noop, always return 0 and never throw/triplongaddWithoutBreaking(long bytes) This is a noop, nothing is added, always return 0voidcircuitBreak(String fieldName, long bytesNeeded) This is a noop, a noop breaker never tripA noop breakerCircuitBreaker.Durabilityis alwaysCircuitBreaker.Durability.PERMANENTlonggetLimit()A noop breaker have a constant limit of -1getName()return the name of this breakerdoubleA noop breaker have no overhead, always return 0longA noop breaker never trip, always return 0longgetUsed()This is a noop, always return 0voidsetLimitAndOverhead(long limit, double overhead) Limit and overhead are constant for a noop breaker.
-
Field Details
-
LIMIT
public static final int LIMITThe limit of this breaker is always -1- See Also:
-
-
Constructor Details
-
NoopCircuitBreaker
Creates a new NoopCircuitBreaker (that never trip) with the given name- Parameters:
name- the name of this breaker
-
-
Method Details
-
circuitBreak
This is a noop, a noop breaker never trip- Specified by:
circuitBreakin interfaceCircuitBreaker- Parameters:
fieldName- name of this noop breakerbytesNeeded- bytes needed
-
addEstimateBytesAndMaybeBreak
public double addEstimateBytesAndMaybeBreak(long bytes, String label) throws CircuitBreakingException This is a noop, always return 0 and never throw/trip- Specified by:
addEstimateBytesAndMaybeBreakin interfaceCircuitBreaker- Parameters:
bytes- number of bytes to addlabel- string label describing the bytes being added- Returns:
- always return 0
- Throws:
CircuitBreakingException- never thrown
-
addWithoutBreaking
public long addWithoutBreaking(long bytes) This is a noop, nothing is added, always return 0- Specified by:
addWithoutBreakingin interfaceCircuitBreaker- Parameters:
bytes- number of bytes to add (ignored)- Returns:
- always return 0
-
getUsed
public long getUsed()This is a noop, always return 0- Specified by:
getUsedin interfaceCircuitBreaker- Returns:
- always return 0
-
getLimit
public long getLimit()A noop breaker have a constant limit of -1- Specified by:
getLimitin interfaceCircuitBreaker- Returns:
- always return -1
-
getOverhead
public double getOverhead()A noop breaker have no overhead, always return 0- Specified by:
getOverheadin interfaceCircuitBreaker- Returns:
- always return 0
-
getTrippedCount
public long getTrippedCount()A noop breaker never trip, always return 0- Specified by:
getTrippedCountin interfaceCircuitBreaker- Returns:
- always return 0
-
getName
return the name of this breaker- Specified by:
getNamein interfaceCircuitBreaker- Returns:
- the name of this breaker
-
getDurability
A noop breakerCircuitBreaker.Durabilityis alwaysCircuitBreaker.Durability.PERMANENT- Specified by:
getDurabilityin interfaceCircuitBreaker- Returns:
- always return
CircuitBreaker.Durability.PERMANENT
-
setLimitAndOverhead
public void setLimitAndOverhead(long limit, double overhead) Limit and overhead are constant for a noop breaker. this is a noop.- Specified by:
setLimitAndOverheadin interfaceCircuitBreaker- Parameters:
limit- the desired limit (ignored)overhead- the desired overhead (ignored)
-