Class NoopCircuitBreaker

java.lang.Object
org.elasticsearch.common.breaker.NoopCircuitBreaker
All Implemented Interfaces:
CircuitBreaker

public class NoopCircuitBreaker extends Object implements CircuitBreaker
A CircuitBreaker that doesn't increment or adjust, and all operations are basically noops
  • Field Details

  • Constructor Details

    • NoopCircuitBreaker

      public NoopCircuitBreaker(String name)
  • Method Details

    • circuitBreak

      public void circuitBreak(String fieldName, long bytesNeeded)
      Description copied from interface: CircuitBreaker
      Trip the circuit breaker
      Specified by:
      circuitBreak in interface CircuitBreaker
      Parameters:
      fieldName - name of the field responsible for tripping the breaker
      bytesNeeded - bytes asked for but unable to be allocated
    • addEstimateBytesAndMaybeBreak

      public void addEstimateBytesAndMaybeBreak(long bytes, String label) throws CircuitBreakingException
      Description copied from interface: CircuitBreaker
      Add bytes to the breaker and trip if the that puts breaker over the limit.
      Specified by:
      addEstimateBytesAndMaybeBreak in interface CircuitBreaker
      Parameters:
      bytes - number of bytes to add
      label - 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 interface CircuitBreaker
    • getUsed

      public long getUsed()
      Specified by:
      getUsed in interface CircuitBreaker
      Returns:
      the currently used bytes the breaker is tracking
    • getLimit

      public long getLimit()
      Specified by:
      getLimit in interface CircuitBreaker
      Returns:
      maximum number of bytes the circuit breaker can track before tripping
    • getOverhead

      public double getOverhead()
      Specified by:
      getOverhead in interface CircuitBreaker
      Returns:
      overhead of circuit breaker
    • getTrippedCount

      public long getTrippedCount()
      Specified by:
      getTrippedCount in interface CircuitBreaker
      Returns:
      the number of times the circuit breaker has been tripped
    • getName

      public String getName()
      Specified by:
      getName in interface CircuitBreaker
      Returns:
      the name of the breaker
    • getDurability

      public CircuitBreaker.Durability getDurability()
      Specified by:
      getDurability in interface CircuitBreaker
      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 interface CircuitBreaker
      Parameters:
      limit - the desired limit
      overhead - the desired overhead constant