Class IrisQueryScheduler

java.lang.Object
com.illumon.iris.controller.IrisQueryScheduler
All Implemented Interfaces:
IrisScheduler
Direct Known Subclasses:
IrisQuerySchedulerContinuous, IrisQuerySchedulerDaily, IrisQuerySchedulerDependent, IrisQuerySchedulerMonthly, IrisQuerySchedulerTemporary

public abstract class IrisQueryScheduler extends Object implements IrisScheduler
Base class for basic query scheduling object to contain the parameters used for scheduling. By itself it can not perform scheduling as it doesn't specify on what days a query should run, it simply specifies start/stop values. Since it can't handle scheduling by itself, the implementation of the IrisScheduler class is left to subclasses. Negative values for startTime and stopTime would be before 1970; they are used to indicate no start or stop time. This can happen if query scheduling is disabled, or we couldn't find a valid start time within the specified look-forward time.
  • Field Details

    • RESTART_COUNT_UNLIMITED

      public static final int RESTART_COUNT_UNLIMITED
      See Also:
    • timeZone

      protected TimeZone timeZone
    • overnight

      protected boolean overnight
    • DISABLED_PARSE_STRING

      public static final String DISABLED_PARSE_STRING
      See Also:
  • Method Details

    • getRestartWhenRunningValues

      public static IrisQueryScheduler.RestartWhenRunning[] getRestartWhenRunningValues()
    • getRestartWhenRunning

      @NotNull public IrisQueryScheduler.RestartWhenRunning getRestartWhenRunning()
      Get the actual value of restart-when-running. This does not define the behavior which can be overridden by subclasses. To determine whether the query should actually restart when running, use shouldRestartWhenRunning().
      Returns:
      the defined restart-when-running value
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • getStartTime

      public String getStartTime()
    • getStartTimeOfDay

      public LocalTime getStartTimeOfDay()
      Description copied from interface: IrisScheduler
      Get the schedulers start time as a general time of day. Note that this is not the next absolute start time given by IrisScheduler.getStartTimeInMillis()
      Specified by:
      getStartTimeOfDay in interface IrisScheduler
      Returns:
      a LocalTime representing the start time of the query
    • getStopTime

      public String getStopTime()
    • getStopTimeOfDay

      public LocalTime getStopTimeOfDay()
      Description copied from interface: IrisScheduler
      Get the scheduler's stop time as a general time of day.
      Specified by:
      getStopTimeOfDay in interface IrisScheduler
      Returns:
      the stop time of the query, if there was one, or null
    • getTimeZoneString

      public String getTimeZoneString()
      Description copied from interface: IrisScheduler
      Get the time zone string that is used for all LocalTimes
      Specified by:
      getTimeZoneString in interface IrisScheduler
      Returns:
      the time zone string
    • getSchedulingDisabled

      public boolean getSchedulingDisabled()
      Description copied from interface: IrisScheduler
      Return true if scheduling is disabled.
      Specified by:
      getSchedulingDisabled in interface IrisScheduler
      Returns:
      true if scheduling is disabled, false if scheduling is enabled.
    • getStartTimeInMillis

      public long getStartTimeInMillis()
      Description copied from interface: IrisScheduler
      Return the scheduler's next scheduled start time. This must be called after IrisScheduler.generateSchedulerTimes(Long, Map). A value of -1 means there is no start time.
      Specified by:
      getStartTimeInMillis in interface IrisScheduler
      Returns:
      the query's next start time in millis
    • getStopTimeInMillis

      public long getStopTimeInMillis()
      Description copied from interface: IrisScheduler
      Return the scheduler's next scheduled stop time. This must be called after IrisScheduler.generateSchedulerTimes(Long, Map). A value of -1 means there is no stop time.
      Specified by:
      getStopTimeInMillis in interface IrisScheduler
      Returns:
      the query's next start time in millis
    • hasStopTime

      public boolean hasStopTime()
      Description copied from interface: IrisScheduler
      Return true if the scheduling has a determinable stop time.
      Specified by:
      hasStopTime in interface IrisScheduler
      Returns:
      true if the scheduling has a determinable stop time, false otherwise
    • hasStartTime

      public boolean hasStartTime()
      Return true if the scheduling has a determinable start time.
      Returns:
      true if the scheduling has a determinable start time, false otherwise
    • getRestartErrorCount

      public int getRestartErrorCount()
      Description copied from interface: IrisScheduler
      Indicate how many times a failed query should be restarted.
      Specified by:
      getRestartErrorCount in interface IrisScheduler
      Returns:
      the number of times a failed query restart attempt should be made
    • getRestartDelayMinutes

      public int getRestartDelayMinutes()
      Description copied from interface: IrisScheduler
      Indicate how many minutes to delay between failed query restart attempts.
      Specified by:
      getRestartDelayMinutes in interface IrisScheduler
      Returns:
      the number of minutes to delay between failed query restart attempts
    • shouldRestartWhenRunning

      public boolean shouldRestartWhenRunning()
      Description copied from interface: IrisScheduler
      Indicates whether a query should be restarted by the scheduler when running.
      • For a dependent query, indicates whether the query should start immediately if the dependency condition is true and the query is not in a terminal state
      • For a continually scheduled query, it indicates that a scheduled restart should cause the running query to be stopped (always true)
      • For daily and monthly scheduled queries, it indicates whether a query that's scheduled to start at a specified time should be restarted, even if it's already running (e.g. started manually out of scheduled run-time)
      Specified by:
      shouldRestartWhenRunning in interface IrisScheduler
      Returns:
      true if the query should be restarted when its dependent-on condition is met
    • getStartTimeDisplay

      public String getStartTimeDisplay(String[] strings)
      Specified by:
      getStartTimeDisplay in interface IrisScheduler
    • getStopTimeDisplay

      public String getStopTimeDisplay(String[] strings)
      Specified by:
      getStopTimeDisplay in interface IrisScheduler
    • getTimeZoneDisplay

      public String getTimeZoneDisplay(String[] strings)
      Specified by:
      getTimeZoneDisplay in interface IrisScheduler
    • getRepeatInterval

      public long getRepeatInterval()
      Description copied from interface: IrisScheduler
      Return the repeat interval in minutes.
      Specified by:
      getRepeatInterval in interface IrisScheduler
      Returns:
      the repeat interval in minutes.
    • isRepeatEnabled

      public boolean isRepeatEnabled()
      Description copied from interface: IrisScheduler
      Return true if the scheduling has repeat-interval enabled.
      Specified by:
      isRepeatEnabled in interface IrisScheduler
      Returns:
      true if the scheduling has repeat-interval enabled, false otherwise
    • skipIfUnsuccessful

      public boolean skipIfUnsuccessful()
      Description copied from interface: IrisScheduler
      Return true if the query scheduling should be skipped if the previous run was unsuccessful.
      Specified by:
      skipIfUnsuccessful in interface IrisScheduler
      Returns:
      true if the query scheduling should be skipped if the previous run was unsuccessful, false otherwise
    • isStartTimeFirstForDay

      public boolean isStartTimeFirstForDay()
      Description copied from interface: IrisScheduler
      Return true if the determined start time is the first possible one for the day.
      Specified by:
      isStartTimeFirstForDay in interface IrisScheduler
      Returns:
      true if the determined start time is the first possible one for the day, false otherwise
    • validate

      public void validate(Map<Long,PersistentQueryInfo> allConfigurations)
      Description copied from interface: IrisScheduler
      Validate the scheduling.
      Specified by:
      validate in interface IrisScheduler
      Parameters:
      allConfigurations - a map of all current query configurations which can be used for additional validation
    • isOvernight

      public boolean isOvernight()
      Description copied from interface: IrisScheduler
      Indicate if this scheduler is overnight.
      Specified by:
      isOvernight in interface IrisScheduler
      Returns:
      if this scheduler is overnight
    • isStopTimeDisabled

      protected final boolean isStopTimeDisabled()