Class RetryImpl.ContextImpl

java.lang.Object
io.github.resilience4j.retry.internal.RetryImpl.ContextImpl
All Implemented Interfaces:
Retry.Context<T>
Enclosing class:
RetryImpl<T>

public final class RetryImpl.ContextImpl extends Object implements Retry.Context<T>
  • Field Details

  • Constructor Details

    • ContextImpl

      private ContextImpl()
  • Method Details

    • onComplete

      public void onComplete()
      Description copied from interface: Retry.Context
      Records a successful call or retryable call with the needed generated retry events. When there is a successful retry before reaching the max retries limit, it will generate a RetryOnSuccessEvent. When the retry reaches the max retries limit, it will generate a RetryOnErrorEvent with last exception or MaxRetriesExceeded if no other exceptions is thrown.
      Specified by:
      onComplete in interface Retry.Context<T>
    • onResult

      public boolean onResult(T result)
      Specified by:
      onResult in interface Retry.Context<T>
      Parameters:
      result - the returned result from the called logic
      Returns:
      true if we need to retry again or false if no retry anymore
    • onError

      public void onError(Exception exception) throws Exception
      Description copied from interface: Retry.Context
      Handles a checked exception
      Specified by:
      onError in interface Retry.Context<T>
      Parameters:
      exception - the exception to handle
      Throws:
      Exception - when retry count has exceeded
    • onRuntimeError

      public void onRuntimeError(RuntimeException runtimeException)
      Description copied from interface: Retry.Context
      Handles a runtime exception
      Specified by:
      onRuntimeError in interface Retry.Context<T>
      Parameters:
      runtimeException - the exception to handle
    • throwOrSleepAfterException

      private void throwOrSleepAfterException() throws Exception
      Throws:
      Exception
    • throwOrSleepAfterRuntimeException

      private void throwOrSleepAfterRuntimeException()
    • waitIntervalAfterException

      private void waitIntervalAfterException(int currentNumOfAttempts, io.github.resilience4j.core.functions.Either<Throwable, T> either) throws Exception
      Throws:
      Exception
    • waitIntervalAfterRuntimeException

      private void waitIntervalAfterRuntimeException(int currentNumOfAttempts, io.github.resilience4j.core.functions.Either<Throwable, T> either)