Interface Retry.Context<T>

  • Type Parameters:
    T - the result type
    All Known Implementing Classes:
    RetryImpl.ContextImpl
    Enclosing interface:
    Retry

    public static interface Retry.Context<T>
    the retry context which will be used during the retry iteration to decide what can be done on error , result, on runtime error
    • Method Detail

      • onSuccess

        @Deprecated
        void onSuccess()
        Deprecated.
        since 1.2.0
        Records a successful call.
      • onComplete

        void onComplete()
        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.
      • onResult

        boolean onResult​(T result)
        Parameters:
        result - the returned result from the called logic
        Returns:
        true if we need to retry again or false if no retry anymore
      • onError

        void onError​(java.lang.Exception exception)
              throws java.lang.Exception
        Handles a checked exception
        Parameters:
        exception - the exception to handle
        Throws:
        java.lang.Exception - when retry count has exceeded
      • onRuntimeError

        void onRuntimeError​(java.lang.RuntimeException runtimeException)
        Handles a runtime exception
        Parameters:
        runtimeException - the exception to handle
        Throws:
        java.lang.RuntimeException - when retry count has exceeded