Class JobScheduleStrategies

java.lang.Object
org.graylog.scheduler.JobScheduleStrategies

public class JobScheduleStrategies extends Object
Provides a few standard schedule strategies for triggers.
  • Constructor Details

    • JobScheduleStrategies

      @Inject public JobScheduleStrategies(JobSchedulerClock clock)
  • Method Details

    • nextTime

      public Optional<org.joda.time.DateTime> nextTime(JobTriggerDto trigger)
      Calculates the next execution time. This uses the previous JobTriggerDto.nextTime() to calculate the next one based on the trigger schedule.

      If this returns an empty Optional, the trigger should not be executed anymore.

      Parameters:
      trigger - the trigger to use for the calculation
      Returns:
      the next time this trigger should fire, empty optional if the trigger should not fire anymore
    • nextFutureTime

      public Optional<org.joda.time.DateTime> nextFutureTime(JobTriggerDto trigger)
      Calculates the next time in the future. This uses the previous JobTriggerDto.nextTime() to calculate the next one based on the trigger schedule. It recalculates the next time until it is in the future.

      If this returns an empty Optional, the trigger should not be executed anymore.

      Parameters:
      trigger - the trigger to use for the calculation
      Returns:
      the next time this trigger should fire, empty optional if the trigger should not fire anymore