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 Summary
Fields Modifier and Type Field Description static String
SYSPROP_PREFIX
static String
SYSPROP_QUERY_CPU
static String
SYSPROP_QUERY_LOADAVG
static String
SYSPROP_QUERY_MEM
static String
SYSPROP_UPDATE_CPU
static String
SYSPROP_UPDATE_LOADAVG
static String
SYSPROP_UPDATE_MEM
-
Constructor Summary
Constructors Constructor Description CircuitBreakerRegistry(CoreContainer coreContainer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<CircuitBreaker>
checkTripped(org.apache.solr.client.solrj.SolrRequest.SolrRequestType requestType)
Check and return circuit breakers that have triggeredvoid
close()
void
deregisterAll()
static void
deregisterGlobal()
boolean
isEnabled(org.apache.solr.client.solrj.SolrRequest.SolrRequestType requestType)
static Set<CircuitBreaker>
listGlobal()
List all registered circuit breakers for global contextvoid
register(CircuitBreaker circuitBreaker)
Register a circuit breaker for a corestatic void
registerGlobal(CircuitBreaker circuitBreaker)
Register a global circuit breakerstatic String
toErrorMessage(List<CircuitBreaker> circuitBreakerList)
Construct the final error message to be printed when circuit breakers trip.
-
-
-
Field Detail
-
SYSPROP_PREFIX
public static final String SYSPROP_PREFIX
- See Also:
- Constant Field Values
-
SYSPROP_UPDATE_CPU
public static final String SYSPROP_UPDATE_CPU
- See Also:
- Constant Field Values
-
SYSPROP_UPDATE_MEM
public static final String SYSPROP_UPDATE_MEM
- See Also:
- Constant Field Values
-
SYSPROP_UPDATE_LOADAVG
public static final String SYSPROP_UPDATE_LOADAVG
- See Also:
- Constant Field Values
-
SYSPROP_QUERY_CPU
public static final String SYSPROP_QUERY_CPU
- See Also:
- Constant Field Values
-
SYSPROP_QUERY_MEM
public static final String SYSPROP_QUERY_MEM
- See Also:
- Constant Field Values
-
SYSPROP_QUERY_LOADAVG
public static final String SYSPROP_QUERY_LOADAVG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CircuitBreakerRegistry
public CircuitBreakerRegistry(CoreContainer coreContainer)
-
-
Method Detail
-
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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-