Package org.jobrunr.jobs.filters
Class RetryFilter
- java.lang.Object
-
- org.jobrunr.jobs.filters.RetryFilter
-
- All Implemented Interfaces:
ElectStateFilter
,JobFilter
public class RetryFilter extends java.lang.Object implements ElectStateFilter
A JobFilter of typeElectStateFilter
that will retry the job if it fails for up to 10 times. This JobFilter is added by default in JobRunr.If you want to configure the amount of retries, create a new instance and pass it to the JobRunrConfiguration, e.g.:
JobRunr.configure() ... .withJobFilter(new RetryFilter(20)) // this will result in 20 retries ... .initialize();
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_NBR_OF_RETRIES
-
Constructor Summary
Constructors Constructor Description RetryFilter()
RetryFilter(int numberOfRetries)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
getExponentialBackoffPolicy(Job job, int seed)
protected long
getSecondsToAdd(Job job)
void
onStateElection(Job job, JobState newState)
-
-
-
Field Detail
-
DEFAULT_NBR_OF_RETRIES
public static final int DEFAULT_NBR_OF_RETRIES
- See Also:
- Constant Field Values
-
-
Method Detail
-
onStateElection
public void onStateElection(Job job, JobState newState)
- Specified by:
onStateElection
in interfaceElectStateFilter
-
getSecondsToAdd
protected long getSecondsToAdd(Job job)
-
getExponentialBackoffPolicy
protected long getExponentialBackoffPolicy(Job job, int seed)
-
-