Class RetryPolicy
java.lang.Object
co.yellowdog.platform.model.RetryPolicy
- All Implemented Interfaces:
Serializable
Policy that can be specified in a
RunSpecification to control how many times a Task can retry in the
event that an attempt to execute the Task errors.- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionRetryPolicy(int maxRetries, Selection<TaskErrorSelector> retryErrors) Creates a newRetryPolicyinstance. -
Method Summary
Modifier and TypeMethodDescriptionstatic RetryPolicy.Builderbuilder()intThe maximum number of times aTaskcan be retried.static RetryPolicyretry(int maxRetries) static RetryPolicyretry(int maxRetries, Selection<TaskErrorSelector> retryErrors) RetryTasks for the maxRetries specified.
-
Constructor Details
-
RetryPolicy
Creates a newRetryPolicyinstance.- Parameters:
maxRetries- The maximum number of times aTaskcan be retried. The maximum total number of attempts will always be `maxRetries + 1` because the first attempt is not a retry. Must be 0 or higher. Zero is allowed if you want to be explicit, and to make it easy to change the number of retries without having to omit the policy. Specifying zero is effectively the same as having noRetryPolicy.retryErrors- OptionalSelectionwhich, if specified, only allows attempts matching theSelectionto be retried. Note that it is only theTaskErrorfrom the most recent attempt that is evaluated by theSelection.
-
-
Method Details
-
retry
- Parameters:
maxRetries- The maximum number of times aTaskcan be retried, must be 0 or more- Returns:
- The
RetryPolicy
-
retry
RetryTasks for the maxRetries specified. Only retry if the most recent error matches theSelection.- Parameters:
maxRetries- The maximum number of times aTaskcan be retried, must be 0 or moreretryErrors- Which errors can be retried, if theSelectionis null, allTasks can be retried- Returns:
- The
RetryPolicy
-
builder
-
getMaxRetries
public int getMaxRetries()The maximum number of times aTaskcan be retried. The maximum total number of attempts will always be `maxRetries + 1` because the first attempt is not a retry. Must be 0 or higher. Zero is allowed if you want to be explicit, and to make it easy to change the number of retries without having to omit the policy. Specifying zero is effectively the same as having noRetryPolicy. -
getRetryErrors
-