public class ChildMemoryCircuitBreaker extends java.lang.Object implements CircuitBreaker
CircuitBreaker.Type
FIELDDATA, IN_FLIGHT_REQUESTS, PARENT, REQUEST
Constructor and Description |
---|
ChildMemoryCircuitBreaker(BreakerSettings settings,
ChildMemoryCircuitBreaker oldBreaker,
org.apache.logging.log4j.Logger logger,
HierarchyCircuitBreakerService parent,
java.lang.String name)
Create a circuit breaker that will break if the number of estimated
bytes grows above the limit.
|
ChildMemoryCircuitBreaker(BreakerSettings settings,
org.apache.logging.log4j.Logger logger,
HierarchyCircuitBreakerService parent,
java.lang.String name)
Create a circuit breaker that will break if the number of estimated
bytes grows above the limit.
|
Modifier and Type | Method and Description |
---|---|
double |
addEstimateBytesAndMaybeBreak(long bytes,
java.lang.String label)
Add a number of bytes, tripping the circuit breaker if the aggregated
estimates are above the limit.
|
long |
addWithoutBreaking(long bytes)
Add an exact number of bytes, not checking for tripping the
circuit breaker.
|
void |
circuitBreak(java.lang.String fieldName,
long bytesNeeded)
Method used to trip the breaker, delegates to the parent to determine
whether to trip the breaker or not
|
long |
getLimit() |
java.lang.String |
getName() |
double |
getOverhead() |
long |
getTrippedCount() |
long |
getUsed() |
public ChildMemoryCircuitBreaker(BreakerSettings settings, org.apache.logging.log4j.Logger logger, HierarchyCircuitBreakerService parent, java.lang.String name)
settings
- settings to configure this breakerparent
- parent circuit breaker service to delegate tripped breakers toname
- the name of the breakerpublic ChildMemoryCircuitBreaker(BreakerSettings settings, ChildMemoryCircuitBreaker oldBreaker, org.apache.logging.log4j.Logger logger, HierarchyCircuitBreakerService parent, java.lang.String name)
settings
- settings to configure this breakerparent
- parent circuit breaker service to delegate tripped breakers toname
- the name of the breakeroldBreaker
- the previous circuit breaker to inherit the used value from (starting offset)public void circuitBreak(java.lang.String fieldName, long bytesNeeded)
circuitBreak
in interface CircuitBreaker
fieldName
- name of the field responsible for tripping the breakerbytesNeeded
- bytes asked for but unable to be allocatedpublic double addEstimateBytesAndMaybeBreak(long bytes, java.lang.String label) throws CircuitBreakingException
addEstimateBytesAndMaybeBreak
in interface CircuitBreaker
bytes
- number of bytes to add to the breakerlabel
- string label describing the bytes being addedCircuitBreakingException
public long addWithoutBreaking(long bytes)
addWithoutBreaking
in interface CircuitBreaker
bytes
- number of bytes to add to the breakerpublic long getUsed()
getUsed
in interface CircuitBreaker
public long getLimit()
getLimit
in interface CircuitBreaker
public double getOverhead()
getOverhead
in interface CircuitBreaker
public long getTrippedCount()
getTrippedCount
in interface CircuitBreaker
public java.lang.String getName()
getName
in interface CircuitBreaker