RetryPolicy.RetryConfig.Builder
@ExperimentalRetryPolicy
public final class RetryPolicy.RetryConfig.Builder
A builder class for creating and customizing RetryConfig objects.
While predefined configs like DEFAULT_DELAY_RETRY are recommended for typical recovery scenarios, this builder allows for fine-tuned control when specific requirements necessitate a different approach.
Summary
Public constructors |
|---|
Builder() |
Public methods |
|
|---|---|
@NonNull RetryPolicy.RetryConfig |
build()Builds the customized |
@NonNull RetryPolicy.RetryConfig.Builder |
setRetryDelayInMillis(@IntRange(from = 100, to = 2000) long timeoutInMillis)Sets the retry delay in milliseconds. |
@NonNull RetryPolicy.RetryConfig.Builder |
setShouldRetry(boolean shouldRetry)Specifies whether a retry should be attempted. |
Public constructors
Public methods
build
public @NonNull RetryPolicy.RetryConfig build()
Builds the customized RetryConfig object.
| Returns | |
|---|---|
@NonNull RetryPolicy.RetryConfig |
The configured RetryConfig. |
setRetryDelayInMillis
public @NonNull RetryPolicy.RetryConfig.Builder setRetryDelayInMillis(@IntRange(from = 100, to = 2000) long timeoutInMillis)
Sets the retry delay in milliseconds.
If set, the initialization will be retried after the specified delay. For optimal results, the delay should be within the range of 100 to 2000 milliseconds. This aligns with lab testing, which suggests this range provides sufficient recovery time for most common camera issues while minimizing latency.
| Parameters | |
|---|---|
@IntRange(from = 100, to = 2000) long timeoutInMillis |
The delay in milliseconds. |
| Returns | |
|---|---|
@NonNull RetryPolicy.RetryConfig.Builder |
|
setShouldRetry
public @NonNull RetryPolicy.RetryConfig.Builder setShouldRetry(boolean shouldRetry)
Specifies whether a retry should be attempted.
| Parameters | |
|---|---|
boolean shouldRetry |
If true (the default), initialization will be retried. If false, initialization will not be retried. |
| Returns | |
|---|---|
@NonNull RetryPolicy.RetryConfig.Builder |
|