Class RetryImpl<T>

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

public class RetryImpl<T> extends Object implements Retry
  • Field Details

    • sleepFunction

      static io.github.resilience4j.core.functions.CheckedConsumer<Long> sleepFunction
    • metrics

      private final Retry.Metrics metrics
    • eventProcessor

      private final RetryImpl<T>.RetryEventProcessor eventProcessor
    • resultPredicate

      @Nullable private final Predicate<T> resultPredicate
    • consumeResultBeforeRetryAttempt

      @Nullable private final BiConsumer<Integer,T> consumeResultBeforeRetryAttempt
    • name

      private final String name
    • config

      private final RetryConfig config
    • tags

      private final Map<String,String> tags
    • maxAttempts

      private final int maxAttempts
    • failAfterMaxAttempts

      private final boolean failAfterMaxAttempts
    • intervalBiFunction

      private final io.github.resilience4j.core.IntervalBiFunction<T> intervalBiFunction
    • exceptionPredicate

      private final Predicate<Throwable> exceptionPredicate
    • succeededAfterRetryCounter

      private final LongAdder succeededAfterRetryCounter
    • failedAfterRetryCounter

      private final LongAdder failedAfterRetryCounter
    • succeededWithoutRetryCounter

      private final LongAdder succeededWithoutRetryCounter
    • failedWithoutRetryCounter

      private final LongAdder failedWithoutRetryCounter
  • Constructor Details

  • Method Details

    • setSleepFunction

      public static void setSleepFunction(io.github.resilience4j.core.functions.CheckedConsumer<Long> sleepFunction)
    • getName

      public String getName()
      Returns the ID of this Retry.
      Specified by:
      getName in interface Retry
      Returns:
      the ID of this Retry
    • context

      public Retry.Context context()
      Description copied from interface: Retry
      Creates a retry Context.
      Specified by:
      context in interface Retry
      Returns:
      the retry Context
    • asyncContext

      public Retry.AsyncContext asyncContext()
      Description copied from interface: Retry
      Creates a async retry Context.
      Specified by:
      asyncContext in interface Retry
      Returns:
      the async retry Context
    • getRetryConfig

      public RetryConfig getRetryConfig()
      Description copied from interface: Retry
      Returns the RetryConfig of this Retry.
      Specified by:
      getRetryConfig in interface Retry
      Returns:
      the RetryConfig of this Retry
    • getTags

      public Map<String,String> getTags()
      Description copied from interface: Retry
      Returns an unmodifiable map with tags assigned to this Retry.
      Specified by:
      getTags in interface Retry
      Returns:
      the tags assigned to this Retry in an unmodifiable map
    • publishRetryEvent

      private void publishRetryEvent(Supplier<RetryEvent> event)
    • getEventPublisher

      public Retry.EventPublisher getEventPublisher()
      Description copied from interface: Retry
      Returns an EventPublisher can be used to register event consumers.
      Specified by:
      getEventPublisher in interface Retry
      Returns:
      an EventPublisher
    • getMetrics

      public Retry.Metrics getMetrics()
      Get the Metrics of this Retry instance.
      Specified by:
      getMetrics in interface Retry
      Returns:
      the Metrics of this Retry instance