RetryTask

constructor(@NonNull task: Task, @NonNull retryTask: Task, shouldRetry: BooleanSupplier, maxRetries: Int)

Creates a new RetryTask.

Parameters

task

Supplies the task to run on the first attempt.

retryTask

The task to run on retries if the retry condition fails.

shouldRetry

A condition that returns true if a retry should be attempted, or false if the task should finish without retrying.

maxRetries

The maximum number of retries allowed.


constructor(@NonNull task: Task, shouldRetry: BooleanSupplier, maxRetries: Int)

Creates a new RetryTask where the retry task is the same as the initial one.

Parameters

task

A supplier that creates a new instance of the task to run.

shouldRetry

A condition that returns true if a retry should be attempted, or false if the task should finish without retrying.

maxRetries

The maximum number of retries allowed.