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
Fields inherited from interface org.elasticsearch.common.breaker.CircuitBreaker
ACCOUNTING, FIELDDATA, IN_FLIGHT_REQUESTS, PARENT, REQUEST
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEstimateBytesAndMaybeBreak(long bytes, String label)
Add bytes to the breaker and trip if the that puts breaker over the limit.void
addWithoutBreaking(long bytes)
Add bytes to the circuit breaker without tripping.void
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:
- Constant Field Values
-
-
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
Description copied from interface:CircuitBreaker
Add bytes to the breaker and trip if the that puts breaker over the limit.- Specified by:
addEstimateBytesAndMaybeBreak
in 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:CircuitBreaker
Add bytes to 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
-