Class CPUCircuitBreaker
- java.lang.Object
-
- org.apache.solr.util.circuitbreaker.CircuitBreaker
-
- org.apache.solr.util.circuitbreaker.CPUCircuitBreaker
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,NamedListInitializedPlugin
,SolrCoreAware
public class CPUCircuitBreaker extends CircuitBreaker implements SolrCoreAware
Tracks current CPU usage and triggers if the specified threshold is breached.This circuit breaker gets the recent average CPU usage and uses that data to take a decision. We depend on OperatingSystemMXBean which does not allow a configurable interval of collection of data.
-
-
Constructor Summary
Constructors Constructor Description CPUCircuitBreaker()
CPUCircuitBreaker(CoreContainer coreContainer)
CPUCircuitBreaker(SolrCore core)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
calculateLiveCPUUsage()
Calculate the CPU usage for the system in percentage.double
getCpuUsageThreshold()
String
getErrorMessage()
Get error message when the circuit breaker triggersvoid
inform(SolrCore core)
boolean
isTripped()
Check if circuit breaker is tripped.CPUCircuitBreaker
setThreshold(double thresholdValueInPercentage)
String
toString()
-
Methods inherited from class org.apache.solr.util.circuitbreaker.CircuitBreaker
close, getErrorCode, getRequestTypes, init, isWarnOnly, setRequestTypes, setWarnOnly
-
-
-
-
Constructor Detail
-
CPUCircuitBreaker
public CPUCircuitBreaker()
-
CPUCircuitBreaker
@Deprecated(since="9.5") public CPUCircuitBreaker(SolrCore core)
Deprecated.
-
CPUCircuitBreaker
public CPUCircuitBreaker(CoreContainer coreContainer)
-
-
Method Detail
-
isTripped
public boolean isTripped()
Description copied from class:CircuitBreaker
Check if circuit breaker is tripped.- Specified by:
isTripped
in classCircuitBreaker
-
getErrorMessage
public String getErrorMessage()
Description copied from class:CircuitBreaker
Get error message when the circuit breaker triggers- Specified by:
getErrorMessage
in classCircuitBreaker
-
setThreshold
public CPUCircuitBreaker setThreshold(double thresholdValueInPercentage)
-
getCpuUsageThreshold
public double getCpuUsageThreshold()
-
calculateLiveCPUUsage
protected double calculateLiveCPUUsage()
Calculate the CPU usage for the system in percentage.- Returns:
- Percent CPU usage of -1 if value could not be obtained.
-
inform
public void inform(SolrCore core)
- Specified by:
inform
in interfaceSolrCoreAware
-
-