Class InferenceCircuitBreaker
- java.lang.Object
-
- com.codedstreams.otterstreams.sql.runtime.InferenceCircuitBreaker
-
public class InferenceCircuitBreaker extends Object
Circuit breaker to prevent cascading failures in inference operations.- Since:
- 1.0.0
- Author:
- Nestor Martourez Abiangang A.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInferenceCircuitBreaker.State
-
Constructor Summary
Constructors Constructor Description InferenceCircuitBreaker(String name, int failureThreshold, long resetTimeoutMs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Texecute(Supplier<T> operation)Attempts to execute operation through circuit breaker.intgetFailureCount()InferenceCircuitBreaker.StategetState()
-
-
-
Constructor Detail
-
InferenceCircuitBreaker
public InferenceCircuitBreaker(String name, int failureThreshold, long resetTimeoutMs)
-
-
Method Detail
-
execute
public <T> T execute(Supplier<T> operation) throws Exception
Attempts to execute operation through circuit breaker.- Throws:
Exception
-
getState
public InferenceCircuitBreaker.State getState()
-
getFailureCount
public int getFailureCount()
-
-