Package com.lucimber.dbus.util
Class ErrorRecoveryManager.CircuitBreaker
java.lang.Object
com.lucimber.dbus.util.ErrorRecoveryManager.CircuitBreaker
- Enclosing class:
- ErrorRecoveryManager
Circuit breaker implementation for preventing cascading failures.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescription<T> CompletableFuture<T>
execute
(Supplier<CompletableFuture<T>> operation) Executes an operation through the circuit breaker.int
Gets the current failure count.getState()
Gets the current state of the circuit breaker.void
reset()
Resets the circuit breaker to CLOSED state.
-
Method Details
-
execute
Executes an operation through the circuit breaker.- Type Parameters:
T
- the result type- Parameters:
operation
- the operation to execute- Returns:
- CompletableFuture that completes with the operation result
-
getState
Gets the current state of the circuit breaker. -
getFailureCount
public int getFailureCount()Gets the current failure count. -
reset
public void reset()Resets the circuit breaker to CLOSED state.
-