Package com.azure.core.amqp
Class ExponentialAmqpRetryPolicy
java.lang.Object
com.azure.core.amqp.AmqpRetryPolicy
com.azure.core.amqp.ExponentialAmqpRetryPolicy
A policy to govern retrying of messaging operations in which the delay between retries will grow in an exponential
manner, allowing more time to recover as the number of retries increases.
-
Constructor Summary
ConstructorDescriptionExponentialAmqpRetryPolicy
(AmqpRetryOptions retryOptions) Creates a new instance with a minimum and maximum retry period in addition to maximum number of retry attempts. -
Method Summary
Modifier and TypeMethodDescriptionprotected Duration
calculateRetryDelay
(int retryCount, Duration baseDelay, Duration baseJitter, ThreadLocalRandom random) Calculates the retry delay using exponential backoff.boolean
int
hashCode()
Methods inherited from class com.azure.core.amqp.AmqpRetryPolicy
calculateRetryDelay, getMaxRetries, getRetryOptions
-
Constructor Details
-
ExponentialAmqpRetryPolicy
Creates a new instance with a minimum and maximum retry period in addition to maximum number of retry attempts.- Parameters:
retryOptions
- The options to apply to this retry policy.- Throws:
NullPointerException
- ifretryOptions
isnull
.
-
-
Method Details
-
calculateRetryDelay
protected Duration calculateRetryDelay(int retryCount, Duration baseDelay, Duration baseJitter, ThreadLocalRandom random) Calculates the retry delay using exponential backoff.- Specified by:
calculateRetryDelay
in classAmqpRetryPolicy
- Parameters:
retryCount
- The number of attempts that have been made, including the initial attempt before any retries.baseDelay
- The delay to use for the basis of the exponential backoff.baseJitter
- The duration to use for the basis of the random jitter value.random
- The random number generator used to calculate the jitter.- Returns:
- The duration to delay before retrying a request.
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAmqpRetryPolicy
-
equals
- Overrides:
equals
in classAmqpRetryPolicy
-