Class FallbackBuilder<R>

Type Parameters:
R - result type
All Implemented Interfaces:
PolicyListeners<FallbackBuilder<R>, R>

public class FallbackBuilder<R> extends FailurePolicyBuilder<FallbackBuilder<R>, FallbackConfig<R>, R> implements PolicyListeners<FallbackBuilder<R>, R>
Builds Fallback instances.

Note:

  • This class extends FailurePolicyBuilder which offers additional configuration.
  • This class is not threadsafe.

Author:
Jonathan Halterman
See Also:
  • Method Details

    • build

      public Fallback<R> build()
      Builds a new Fallback using the builder's configuration.
    • onFailedAttempt

      public FallbackBuilder<R> onFailedAttempt(EventListener<ExecutionAttemptedEvent<R>> listener)
      Registers the listener to be called when the last execution attempt prior to the fallback failed. You can also use onFailure to determine when the fallback attempt also fails.

      Note: Any exceptions that are thrown from within the listener are ignored.

      Throws:
      NullPointerException - if listener is null
    • withAsync

      public FallbackBuilder<R> withAsync()
      Configures the fallback to run asynchronously.