public class DatabaseCleanupTask extends LeadershipTask
Constructor and Description |
---|
DatabaseCleanupTask(@NotNull DatabaseCleanupProperties cleanupProperties,
@NotNull JobPersistenceService jobPersistenceService,
@NotNull ClusterPersistenceService clusterPersistenceService,
@NotNull FilePersistenceService filePersistenceService,
@NotNull TagPersistenceService tagPersistenceService,
@NotNull io.micrometer.core.instrument.MeterRegistry registry)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Any cleanup that needs to be performed when this task is stopped due to leadership being revoked.
|
GenieTaskScheduleType |
getScheduleType()
Get the type of scheduling mechanism which should be used to schedule this task.
|
org.springframework.scheduling.Trigger |
getTrigger()
Get the Trigger which this task should be scheduled with.
|
void |
run()
Clean out database based on date.
|
getFixedDelay, getFixedRate
public DatabaseCleanupTask(@NotNull @NotNull DatabaseCleanupProperties cleanupProperties, @NotNull @NotNull JobPersistenceService jobPersistenceService, @NotNull @NotNull ClusterPersistenceService clusterPersistenceService, @NotNull @NotNull FilePersistenceService filePersistenceService, @NotNull @NotNull TagPersistenceService tagPersistenceService, @NotNull @NotNull io.micrometer.core.instrument.MeterRegistry registry)
cleanupProperties
- The properties to use to configure this taskjobPersistenceService
- The persistence service to use to cleanup the data storeclusterPersistenceService
- The cluster service to use to delete terminated clustersfilePersistenceService
- The file service to use to delete unused file referencestagPersistenceService
- The tag service to use to delete unused tag referencesregistry
- The metrics registrypublic GenieTaskScheduleType getScheduleType()
getScheduleType
in class GenieTask
public org.springframework.scheduling.Trigger getTrigger()
getTrigger
in class GenieTask
public void run()
public void cleanup()
cleanup
in class LeadershipTask