public class KeepLastJobs extends java.lang.Object implements JobCleanupStrategy
Concurrent executions of the strategy may have the effect, that more JobInfos than expected are deleted! This may happen, if multiple instances of your application are running in parallel.
| Constructor and Description |
|---|
KeepLastJobs(int numberOfJobsToKeep,
java.util.Optional<java.lang.String> jobType) |
| Modifier and Type | Method and Description |
|---|---|
void |
doCleanUp()
Execute the cleanup of the given repository.
|
void |
setJobRepository(JobRepository jobRepository) |
public KeepLastJobs(int numberOfJobsToKeep,
java.util.Optional<java.lang.String> jobType)
numberOfJobsToKeep - the number of jobs that are keptjobType - the optional type of the jobs@Autowired public void setJobRepository(JobRepository jobRepository)
@Scheduled(fixedRate=600000L) public void doCleanUp()
doCleanUp in interface JobCleanupStrategy