Package org.apache.pinot.spi.utils.retry
Class RetryPolicies
- java.lang.Object
-
- org.apache.pinot.spi.utils.retry.RetryPolicies
-
public class RetryPolicies extends Object
Factory for retry policies.
-
-
Method Summary
Modifier and Type Method Description static ExponentialBackoffRetryPolicyexponentialBackoffRetryPolicy(int maxNumAttempts, long initialDelayMs, double delayScaleFactor)Creates anExponentialBackoffRetryPolicy.static FixedDelayRetryPolicyfixedDelayRetryPolicy(int maxNumAttempts, long delayMs)Creates aFixedDelayRetryPolicy.static NoDelayRetryPolicynoDelayRetryPolicy(int maxNumAttempts)Creates aNoDelayRetryPolicy.static RandomDelayRetryPolicyrandomDelayRetryPolicy(int maxNumAttempts, long minDelayMs, long maxDelayMs)Creates aRandomDelayRetryPolicy.
-
-
-
Method Detail
-
exponentialBackoffRetryPolicy
public static ExponentialBackoffRetryPolicy exponentialBackoffRetryPolicy(int maxNumAttempts, long initialDelayMs, double delayScaleFactor)
Creates anExponentialBackoffRetryPolicy.- Parameters:
maxNumAttempts- The maximum number of attempts to tryinitialDelayMs- The initial delay in milliseconds between attemptsdelayScaleFactor- The factor used for exponential scaling of delay- Returns:
- The retry policy
-
fixedDelayRetryPolicy
public static FixedDelayRetryPolicy fixedDelayRetryPolicy(int maxNumAttempts, long delayMs)
Creates aFixedDelayRetryPolicy.- Parameters:
maxNumAttempts- The maximum number of attempts to trydelayMs- The delay in milliseconds between attempts- Returns:
- The retry policy
-
randomDelayRetryPolicy
public static RandomDelayRetryPolicy randomDelayRetryPolicy(int maxNumAttempts, long minDelayMs, long maxDelayMs)
Creates aRandomDelayRetryPolicy.- Parameters:
maxNumAttempts- The maximum number of attempts to tryminDelayMs- 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)
Creates aNoDelayRetryPolicy.- Parameters:
maxNumAttempts- The maximum number of attempts to try- Returns:
- The retry policy
-
-