Interface OciCircuitBreaker
- 
 public interface OciCircuitBreaker
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static interfaceOciCircuitBreaker.Configstatic classOciCircuitBreaker.ErrorHistoryItem
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description voidacquirePermission()Try to obtain a permission to execute a call.voidaddToHistory(Throwable throwable, Integer status, Map<String,String> messages)StringcircuitBreakerCallNotPermittedErrorMessage(String requestUri)CallNotAllowedExceptioncreateCallNotAllowedException()OciCircuitBreaker.ConfiggetCircuitBreakerConfig()Returns the CircuitBreakerConfig of this CircuitBreaker.longgetCurrentTimestamp()Returns the current time with respect to the CircuitBreaker currentTimeFunction.List<OciCircuitBreaker.ErrorHistoryItem>getHistory()StringgetHistoryAsString()StringgetName()Returns the name of this CircuitBreaker.io.github.resilience4j.circuitbreaker.CircuitBreakergetR4jCircuitBreaker()io.github.resilience4j.circuitbreaker.CircuitBreaker.StategetState()Returns the state of this CircuitBreaker.TimeUnitgetTimestampUnit()Returns the timeUnit of current timestamp.voidonError(long duration, TimeUnit durationUnit, Throwable throwable)Records a failed call.voidonResult(long duration, TimeUnit durationUnit, Object result)This method must be invoked when a call returned a result and the result predicate should decide if the call was successful or not.voidonSuccess(long duration, TimeUnit durationUnit)Records a successful call.voidreleasePermission()Releases a permission.booleantryAcquirePermission()Acquires a permission to execute a call, only if one is available at the time of invocation.
 
- 
- 
- 
Method Detail- 
getR4jCircuitBreakerio.github.resilience4j.circuitbreaker.CircuitBreaker getR4jCircuitBreaker() 
 - 
getNameString getName() Returns the name of this CircuitBreaker.- Returns:
- the name of this CircuitBreaker
 
 - 
getStateio.github.resilience4j.circuitbreaker.CircuitBreaker.State getState() Returns the state of this CircuitBreaker.- Returns:
- the state of this CircuitBreaker
 
 - 
tryAcquirePermissionboolean tryAcquirePermission() Acquires a permission to execute a call, only if one is available at the time of invocation.If a call is not permitted, the number of not permitted calls is increased. Returns false when the state is OPEN or FORCED_OPEN. Returns true when the state is CLOSED or DISABLED. Returns true when the state is HALF_OPEN and further test calls are allowed. Returns false when the state is HALF_OPEN and the number of test calls has been reached. If the state is HALF_OPEN, the number of allowed test calls is decreased. Important: Make sure to call onSuccess or onError after the call is finished. If the call is cancelled before it is invoked, you have to release the permission again. - Returns:
- true if a permission was acquired and false otherwise
 
 - 
releasePermissionvoid releasePermission() Releases a permission.Should only be used when a permission was acquired but not used. Otherwise use CircuitBreaker.onSuccess(long, TimeUnit)orCircuitBreaker.onError(long, TimeUnit, Throwable)to signal a completed or failed call.If the state is HALF_OPEN, the number of allowed test calls is increased by one. 
 - 
acquirePermissionvoid acquirePermission() Try to obtain a permission to execute a call.If a call is not permitted, the number of not permitted calls is increased. Throws a CallNotPermittedException when the state is OPEN or FORCED_OPEN. Returns when the state is CLOSED or DISABLED. Returns when the state is HALF_OPEN and further test calls are allowed. Throws a CallNotPermittedException when the state is HALF_OPEN and the number of test calls has been reached. If the state is HALF_OPEN, the number of allowed test calls is decreased. Important: Make sure to call onSuccess or onError after the call is finished. If the call is cancelled before it is invoked, you have to release the permission again. - Throws:
- io.github.resilience4j.circuitbreaker.CallNotPermittedException- when CircuitBreaker is OPEN or HALF_OPEN and no further test calls are permitted.
 
 - 
getCurrentTimestamplong getCurrentTimestamp() Returns the current time with respect to the CircuitBreaker currentTimeFunction.Returns System.nanoTime() by default. - Returns:
- current timestamp
 
 - 
getTimestampUnitTimeUnit getTimestampUnit() Returns the timeUnit of current timestamp.Default is TimeUnit.NANOSECONDS. - Returns:
- the timeUnit of current timestamp
 
 - 
onErrorvoid onError(long duration, TimeUnit durationUnit, Throwable throwable)Records a failed call.This method must be invoked when a call failed. - Parameters:
- duration- The elapsed time duration of the call
- durationUnit- The duration unit
- throwable- The throwable which must be recorded
 
 - 
onSuccessvoid onSuccess(long duration, TimeUnit durationUnit)Records a successful call.This method must be invoked when a call was successful. - Parameters:
- duration- The elapsed time duration of the call
- durationUnit- The duration unit
 
 - 
onResultvoid onResult(long duration, TimeUnit durationUnit, Object result)This method must be invoked when a call returned a result and the result predicate should decide if the call was successful or not.- Parameters:
- duration- The elapsed time duration of the call
- durationUnit- The duration unit
- result- The result of the protected function
 
 - 
getCircuitBreakerConfigOciCircuitBreaker.Config getCircuitBreakerConfig() Returns the CircuitBreakerConfig of this CircuitBreaker.- Returns:
- the CircuitBreakerConfig of this CircuitBreaker
 
 - 
createCallNotAllowedExceptionCallNotAllowedException createCallNotAllowedException() 
 - 
circuitBreakerCallNotPermittedErrorMessageString circuitBreakerCallNotPermittedErrorMessage(String requestUri) 
 - 
getHistoryList<OciCircuitBreaker.ErrorHistoryItem> getHistory() 
 - 
getHistoryAsStringString getHistoryAsString() 
 
- 
 
-