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 java.lang.Object
implements Retry.Context<T>
  • Method Summary

    Modifier and Type Method Description
    void onComplete()
    Records a successful call or retryable call with the needed generated retry events.
    void onError​(java.lang.Exception exception)
    Handles a checked exception
    boolean onResult​(T result)  
    void onRuntimeError​(java.lang.RuntimeException runtimeException)
    Handles a runtime exception
    void onSuccess()
    Deprecated.
    since 1.2.0

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • onSuccess

      @Deprecated public void onSuccess()
      Deprecated.
      since 1.2.0
      Description copied from interface: Retry.Context
      Records a successful call.
      Specified by:
      onSuccess in interface Retry.Context<T>
    • 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​(java.lang.Exception exception) throws java.lang.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:
      java.lang.Exception - when retry count has exceeded
    • onRuntimeError

      public void onRuntimeError​(java.lang.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