Returns true when the circuit can execute the code ( OPEN or HALF_OPEN state)
Defines the action when trying to use the open circuit.
Defines the action when trying to use the open circuit. The default behavior is to throw CircuitBreakerOpenException
Set an event listener that monitors CircuitBreaker state changes
Note: Use this method only for the standalone mode.
Note: Use this method only for the standalone mode. Generally, using CircuitBreaker.run is sufficient.
This method reports a failure state to the CircuitBreaker.
Note: Use this method only for the standalone mode.
Note: Use this method only for the standalone mode. Generally, using CircuitBreaker.run is sufficient.
This method reports a successful state to the CircuitBreaker.
Reset the lastFailure and close the circuit
Execute the body block through the CircuitBreaker.
Execute the body block through the CircuitBreaker.
If the state is OPEN, this will throw CircuitBreakerOpenException (fail-fast). The state will move to HALF_OPEN state after a certain amount of delay, determined by the delayAfterMarkedDead policy.
If the state is HALF_OPEN, this method allows running the code block once, and if the result is successful, the state will move to CLOSED. If not, the state will be OPEN again.
If the state is CLOSED, the code block will be executed normally. If the result is marked failure or nonRetryable exception is thrown, it will report to the failure to the HealthCheckPolicy. If this policy determines the target service is dead, the circuit will shift to OPEN state to block the future execution.
Force setting the current state.
Note: Use this method only for the standalone mode.
Note: Use this method only for the standalone mode. Generally, using CircuiteBreaker.run is sufficient.
If the connection is open, perform the specified action. The default behavior is fail-fast, i.e., throwing CircuitBreakerOpenException
Set a delay policy until moving the state from OPEN to HALF_OPEN (probing) state.
Set a delay policy until moving the state from OPEN to HALF_OPEN (probing) state. The default is Jittered-exponential backoff delay with the initial interval of 30 seconds.
Set a classifier to determine whether the exception happened in the code block can be ignoreable or not for the accessing the target service.
Set a fallback handler which process the exception happened in the code block.
Set a fallback handler which process the exception happened in the code block. The default is just throwing the exception as it is.
Set a health check policy, which will be used to determine the state of the target service.
Set the name of this CircuitBreaker
Set a recovery policiy which determine if ths circuit breaker can recover from HALF_OPEN to CLOSED.
Set a recovery policiy which determine if ths circuit breaker can recover from HALF_OPEN to CLOSED. The default policy recovers immediately if health check is once successful.
Set a classifier to determine whether the execution result of the code block is successful or not.
(Since version ) see corresponding Javadoc for more information.