Class RetryOperation<T>

java.lang.Object
org.sentrysoftware.metricshub.engine.strategy.utils.RetryOperation<T>
Type Parameters:
T - The type of the result produced by the operation.

public class RetryOperation<T> extends Object
The RetryOperation class provides a mechanism for retrying a function that may throw a RetryableException. It allows configuring the number of retries, the wait strategy between retries, and handles the retry logic.
  • Constructor Details

    • RetryOperation

      public RetryOperation()
  • Method Details

    • run

      public T run(Supplier<T> function)
      Execute the function, if it fails with the RetryableException, retry the function.
      Parameters:
      function - operation to execute that produces a result
      Returns:
      The value returned by the function or default value if all retries fail