Class ScheduleConfig


  • public abstract class ScheduleConfig
    extends Object
    This class reads a schedule for running a periodic background job from a Git config.

    A schedule configuration consists of two parameters:

    • interval: Interval for running the periodic background job. The interval must be larger than zero. The following suffixes are supported to define the time unit for the interval:
      • s, sec, second, seconds
      • m, min, minute, minutes
      • h, hr, hour, hours
      • d, day, days
      • w, week, weeks (1 week is treated as 7 days)
      • mon, month, months (1 month is treated as 30 days)
      • y, year, years (1 year is treated as 365 days)
    • startTime: The start time defines the first execution of the periodic background job. If the configured interval is shorter than startTime - now the start time will be preponed by the maximum integral multiple of interval so that the start time is still in the future. startTime must have one of the following formats:
      • <day of week> <hours>:<minutes>
      • <hours>:<minutes>
      The placeholders can have the following values:
      • <day of week>: Mon, Tue, Wed, Thu, Fri, Sat, Sun
      • <hours>: 00-23
      • <minutes>: 00-59
      The timezone cannot be specified but is always the system default time-zone.

    The section and the subsection from which the interval and startTime parameters are read can be configured.

    Examples for a schedule configuration:

    •  foo.startTime = Fri 10:30
       foo.interval  = 2 day
       
      Assuming that the server is started on Mon 7:00 then startTime - now is 4 days 3:30 hours. This is larger than the interval hence the start time is preponed by the maximum integral multiple of the interval so that start time is still in the future, i.e. preponed by 4 days. This yields a start time of Mon 10:30, next executions are Wed 10:30, Fri 10:30. etc.
    •  foo.startTime = 06:00
       foo.interval = 1 day
       
      Assuming that the server is started on Mon 7:00 then this yields the first run on next Tuesday at 6:00 and a repetition interval of 1 day.