Class RetryPolicies


  • public class RetryPolicies
    extends Object
    Factory for retry policies.
    • Method Detail

      • exponentialBackoffRetryPolicy

        public static ExponentialBackoffRetryPolicy exponentialBackoffRetryPolicy​(int maxNumAttempts,
                                                                                  long initialDelayMs,
                                                                                  double delayScaleFactor)
        Parameters:
        maxNumAttempts - The maximum number of attempts to try
        initialDelayMs - The initial delay in milliseconds between attempts
        delayScaleFactor - The factor used for exponential scaling of delay
        Returns:
        The retry policy
      • fixedDelayRetryPolicy

        public static FixedDelayRetryPolicy fixedDelayRetryPolicy​(int maxNumAttempts,
                                                                  long delayMs)
        Parameters:
        maxNumAttempts - The maximum number of attempts to try
        delayMs - The delay in milliseconds between attempts
        Returns:
        The retry policy
      • randomDelayRetryPolicy

        public static RandomDelayRetryPolicy randomDelayRetryPolicy​(int maxNumAttempts,
                                                                    long minDelayMs,
                                                                    long maxDelayMs)
        Parameters:
        maxNumAttempts - The maximum number of attempts to try
        minDelayMs - The min delay in milliseconds between attempts (inclusive)
        maxDelayMs - The max delay in milliseconds between attempts (exclusive)
        Returns:
        The retry policy
      • noDelayRetryPolicy

        public static NoDelayRetryPolicy noDelayRetryPolicy​(int maxNumAttempts)
        Parameters:
        maxNumAttempts - The maximum number of attempts to try
        Returns:
        The retry policy