Package org.elasticsearch.common.breaker
Class NoopCircuitBreaker
java.lang.Object
org.elasticsearch.common.breaker.NoopCircuitBreaker
- All Implemented Interfaces:
CircuitBreaker
public class NoopCircuitBreaker extends java.lang.Object implements 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
Fields Modifier and Type Field Description static intLIMITFields inherited from interface org.elasticsearch.common.breaker.CircuitBreaker
ACCOUNTING, FIELDDATA, IN_FLIGHT_REQUESTS, PARENT, REQUEST -
Constructor Summary
Constructors Constructor Description NoopCircuitBreaker(java.lang.String name) -
Method Summary
Modifier and Type Method Description doubleaddEstimateBytesAndMaybeBreak(long bytes, java.lang.String label)add bytes to the breaker and maybe triplongaddWithoutBreaking(long bytes)Adjust the circuit breaker without trippingvoidcircuitBreak(java.lang.String fieldName, long bytesNeeded)Trip the circuit breakerCircuitBreaker.DurabilitygetDurability()longgetLimit()java.lang.StringgetName()doublegetOverhead()longgetTrippedCount()longgetUsed()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
public NoopCircuitBreaker(java.lang.String name)
-
-
Method Details
-
circuitBreak
public void circuitBreak(java.lang.String fieldName, long bytesNeeded)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
public double addEstimateBytesAndMaybeBreak(long bytes, java.lang.String label) throws CircuitBreakingExceptionDescription copied from interface:CircuitBreakeradd bytes to the breaker and maybe trip- Specified by:
addEstimateBytesAndMaybeBreakin 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:CircuitBreakerAdjust 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
public java.lang.String 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
-