Class CircuitBreakerRegistry

java.lang.Object
org.apache.solr.util.circuitbreaker.CircuitBreakerRegistry
All Implemented Interfaces:
Closeable, AutoCloseable

public class CircuitBreakerRegistry extends Object implements Closeable
Keeps track of all registered circuit breaker instances for various request types. Responsible for a holistic view of whether a circuit breaker has tripped or not. Circuit breakers may be registered globally and/or per-core. This registry has one instance per core, but keeps a static map of globally registered Circuit Breakers that are always checked.
Since:
9.4
WARNING: This API is experimental and might change in incompatible ways in the next release.
  • Field Details

  • Constructor Details

    • CircuitBreakerRegistry

      public CircuitBreakerRegistry(CoreContainer coreContainer)
  • Method Details

    • parseCircuitBreakersFromProperties

      public static List<CircuitBreaker> parseCircuitBreakersFromProperties(CoreContainer coreContainer)
    • listGlobal

      public static Set<CircuitBreaker> listGlobal()
      List all registered circuit breakers for global context
    • register

      public void register(CircuitBreaker circuitBreaker)
      Register a circuit breaker for a core
    • registerGlobal

      public static void registerGlobal(CircuitBreaker circuitBreaker)
      Register a global circuit breaker
    • deregisterAll

      public void deregisterAll() throws IOException
      Throws:
      IOException
    • deregisterGlobal

      public static void deregisterGlobal()
    • checkTripped

      public List<CircuitBreaker> checkTripped(org.apache.solr.client.solrj.SolrRequest.SolrRequestType requestType)
      Check and return circuit breakers that have triggered
      Parameters:
      requestType - SolrRequest.SolrRequestType to check for.
      Returns:
      CircuitBreakers which have triggered, null otherwise.
    • toErrorMessage

      public static String toErrorMessage(List<CircuitBreaker> circuitBreakerList)
      Construct the final error message to be printed when circuit breakers trip.
      Parameters:
      circuitBreakerList - Input list for circuit breakers.
      Returns:
      Constructed error message.
    • isEnabled

      public boolean isEnabled(org.apache.solr.client.solrj.SolrRequest.SolrRequestType requestType)
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException