Package de.g3s1.oss.cron.api
Interface CronTrigger
- All Known Implementing Classes:
AbstractTrigger,EveryHourCronTrigger,EveryMinuteCronTrigger,NextSecondCronTrigger
public interface CronTrigger
Internal Trigger interface.
Used by the CronTaskScheduler to get the next execution time.
Used by the CronTaskScheduler to get the next execution time.
-
Method Summary
Modifier and TypeMethodDescriptionjava.time.InstantnextExecution(java.time.Instant instant) Calculates the next trigger execution.booleanshouldExecute(java.time.Instant instant) Checks if the job should be executed nowvoidwasTriggered(java.time.Instant instant) Inform the trigger of an execution
-
Method Details
-
nextExecution
java.time.Instant nextExecution(java.time.Instant instant) Calculates the next trigger execution.
The time difference between the returned instant and the provided instance must be at least 1 sek (1000 ms).- Parameters:
instant- Last execution time- Returns:
- next execution time or null if the trigger will not trigger again
-
wasTriggered
void wasTriggered(java.time.Instant instant) Inform the trigger of an execution- Parameters:
instant- Time of execution.
-
shouldExecute
boolean shouldExecute(java.time.Instant instant) Checks if the job should be executed now- Parameters:
instant- estimated time- Returns:
- true if job needs execution
-