Package org.elasticsearch.common.breaker
Class NoopCircuitBreaker
java.lang.Object
org.elasticsearch.common.breaker.NoopCircuitBreaker
- All Implemented Interfaces:
CircuitBreaker
A CircuitBreaker that doesn't increment or adjust, and all operations are
basically noops
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.breaker.CircuitBreaker
CircuitBreaker.Durability, CircuitBreaker.Type -
Field Summary
FieldsFields inherited from interface org.elasticsearch.common.breaker.CircuitBreaker
ACCOUNTING, FIELDDATA, IN_FLIGHT_REQUESTS, PARENT, REQUEST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEstimateBytesAndMaybeBreak(long bytes, String label)Add bytes to the breaker and trip if the that puts breaker over the limit.voidaddWithoutBreaking(long bytes)Add bytes to the circuit breaker without tripping.voidcircuitBreak(String fieldName, long bytesNeeded)Trip the circuit breakerlonggetLimit()getName()doublelonglonggetUsed()voidsetLimitAndOverhead(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:
- Constant Field Values
-
-
Constructor Details
-
NoopCircuitBreaker
-
-
Method Details
-
circuitBreak
Description copied from interface:CircuitBreakerTrip the circuit breaker- Specified by:
circuitBreakin interfaceCircuitBreaker- Parameters:
fieldName- name of the field responsible for tripping the breakerbytesNeeded- bytes asked for but unable to be allocated
-
addEstimateBytesAndMaybeBreak
Description copied from interface:CircuitBreakerAdd bytes to the breaker and trip if the that puts breaker over the limit.- Specified by:
addEstimateBytesAndMaybeBreakin interfaceCircuitBreaker- Parameters:
bytes- number of bytes to addlabel- thing requesting the bytes being added that is included in the exception if the breaker is tripped- Throws:
CircuitBreakingException
-
addWithoutBreaking
public void addWithoutBreaking(long bytes)Description copied from interface:CircuitBreakerAdd bytes to the circuit breaker without tripping.- Specified by:
addWithoutBreakingin interfaceCircuitBreaker
-
getUsed
public long getUsed()- Specified by:
getUsedin interfaceCircuitBreaker- Returns:
- the currently used bytes the breaker is tracking
-
getLimit
public long getLimit()- Specified by:
getLimitin interfaceCircuitBreaker- Returns:
- maximum number of bytes the circuit breaker can track before tripping
-
getOverhead
public double getOverhead()- Specified by:
getOverheadin interfaceCircuitBreaker- Returns:
- overhead of circuit breaker
-
getTrippedCount
public long getTrippedCount()- Specified by:
getTrippedCountin interfaceCircuitBreaker- Returns:
- the number of times the circuit breaker has been tripped
-
getName
- Specified by:
getNamein interfaceCircuitBreaker- Returns:
- the name of the breaker
-
getDurability
- Specified by:
getDurabilityin 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:CircuitBreakersets the new limit and overhead values for the circuit breaker. The resulting write should be readable by other threads.- Specified by:
setLimitAndOverheadin interfaceCircuitBreaker- Parameters:
limit- the desired limitoverhead- the desired overhead constant
-