public class CircuitBreakerState extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CircuitBreakerState.CircuitState |
| Constructor and Description |
|---|
CircuitBreakerState(int requestVolumeThreshold,
double failureRatio) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
CircuitBreakerState.CircuitState |
getCircuitState()
Gets the current circuit state.
|
int |
getHalfOpenSuccessfulResultCounter()
Gets the successful results counter for the half open state.
|
void |
halfOpen() |
boolean |
halfOpenSuccessfulClosedCircuit(int successThreshold) |
void |
incrementHalfOpenSuccessfulResultCounter()
Increments the successful results counter for the half open state.
|
boolean |
isClosedOutcomeSuccessOnly() |
boolean |
isOverFailureThreshold()
Checks to see if the CircuitBreaker is over the given failure threshold.
|
long |
nanosClosed() |
long |
nanosHalfOpen() |
long |
nanosOpen() |
void |
open() |
void |
recordClosedOutcome(boolean success)
Records a success or failure result to the CircuitBreaker.
|
void |
resetHalfOpenSuccessfulResultCounter()
Resets the successful results counter for the half open state.
|
void |
resetResults()
Clears the results queue.
|
void |
setCircuitState(CircuitBreakerState.CircuitState circuitState)
Sets the CircuitBreaker state to the provided enum value.
|
long |
updateAndGet(CircuitBreakerState.CircuitState circuitState)
Updates if the current state equals the provided and returns the amount of nanos.
|
public CircuitBreakerState(int requestVolumeThreshold,
double failureRatio)
public CircuitBreakerState.CircuitState getCircuitState()
public void setCircuitState(CircuitBreakerState.CircuitState circuitState)
circuitState - The state to set the CircuitBreaker to.public void recordClosedOutcome(boolean success)
success - True for a success, false for a failurepublic boolean isClosedOutcomeSuccessOnly()
public void resetResults()
public void incrementHalfOpenSuccessfulResultCounter()
public void resetHalfOpenSuccessfulResultCounter()
public int getHalfOpenSuccessfulResultCounter()
public boolean isOverFailureThreshold()
public long updateAndGet(CircuitBreakerState.CircuitState circuitState)
public long nanosOpen()
public long nanosHalfOpen()
public long nanosClosed()
public void close()
public void open()
public void halfOpen()
public boolean halfOpenSuccessfulClosedCircuit(int successThreshold)
Copyright © 2021. All rights reserved.