Package com.illumon.iris.controller
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.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IrisQueryScheduler.RestartWhenRunning
-
Field Summary
Fields Modifier and Type Field Description static String
DISABLED_PARSE_STRING
protected boolean
overnight
static int
RESTART_COUNT_UNLIMITED
protected TimeZone
timeZone
Fields inherited from interface com.illumon.iris.controller.IrisScheduler
DELIMITER_TOKEN, SCHEDULER_TYPE_TOKEN
-
Method Summary
Modifier and Type Method Description boolean
equals(Object object)
long
getRepeatInterval()
Return the repeat interval in minutes.int
getRestartDelayMinutes()
Indicate how many minutes to delay between failed query restart attempts.int
getRestartErrorCount()
Indicate how many times a failed query should be restarted.IrisQueryScheduler.RestartWhenRunning
getRestartWhenRunning()
Get the actual value of restart-when-running.static IrisQueryScheduler.RestartWhenRunning[]
getRestartWhenRunningValues()
boolean
getSchedulingDisabled()
Return true if scheduling is disabled.String
getStartTime()
String
getStartTimeDisplay(String[] strings)
long
getStartTimeInMillis()
Return the scheduler's next scheduled start time.LocalTime
getStartTimeOfDay()
Get the schedulers start time as a general time of day.String
getStopTime()
String
getStopTimeDisplay(String[] strings)
long
getStopTimeInMillis()
Return the scheduler's next scheduled stop time.LocalTime
getStopTimeOfDay()
Get the scheduler's stop time as a general time of day.String
getTimeZoneDisplay(String[] strings)
String
getTimeZoneString()
Get the time zone string that is used for allLocalTime
sboolean
hasStartTime()
Return true if the scheduling has a determinable start time.boolean
hasStopTime()
Return true if the scheduling has a determinable stop time.boolean
isOvernight()
Indicate if this scheduler is overnight.boolean
isRepeatEnabled()
Return true if the scheduling has repeat-interval enabled.boolean
isStartTimeFirstForDay()
Return true if the determined start time is the first possible one for the day.protected boolean
isStopTimeDisabled()
boolean
shouldRestartWhenRunning()
Indicates whether a query should be restarted by the scheduler when running.boolean
skipIfUnsuccessful()
Return true if the query scheduling should be skipped if the previous run was unsuccessful.void
validate(Map<Long,PersistentQueryInfo> allConfigurations)
Validate the scheduling.Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.illumon.iris.controller.IrisScheduler
areConditionsMet, generateSchedulerTimes, generateStringArrayFromScheduler, getDependentOnQuerySerials, getExpirationTimeMillis, getRunOnFailure, getScheduleDetailDisplay, getTemporaryQueueName, populateSchedulerFromStringArray, setDependentOnQuerySerials, updateDependencyState, updateDependencyState
-
Field Details
-
RESTART_COUNT_UNLIMITED
public static final int RESTART_COUNT_UNLIMITED- See Also:
- Constant Field Values
-
timeZone
-
overnight
protected boolean overnight -
DISABLED_PARSE_STRING
- See Also:
- Constant Field Values
-
-
Method Details
-
getRestartWhenRunningValues
-
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, useshouldRestartWhenRunning()
.- Returns:
- the defined restart-when-running value
-
equals
-
getStartTime
-
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 byIrisScheduler.getStartTimeInMillis()
- Specified by:
getStartTimeOfDay
in interfaceIrisScheduler
- Returns:
- a
LocalTime
representing the start time of the query
-
getStopTime
-
getStopTimeOfDay
Description copied from interface:IrisScheduler
Get the scheduler's stop time as a general time of day.- Specified by:
getStopTimeOfDay
in interfaceIrisScheduler
- Returns:
- the stop time of the query, if there was one, or null
-
getTimeZoneString
Description copied from interface:IrisScheduler
Get the time zone string that is used for allLocalTime
s- Specified by:
getTimeZoneString
in interfaceIrisScheduler
- Returns:
- the time zone string
-
getSchedulingDisabled
public boolean getSchedulingDisabled()Description copied from interface:IrisScheduler
Return true if scheduling is disabled.- Specified by:
getSchedulingDisabled
in interfaceIrisScheduler
- 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 afterIrisScheduler.generateSchedulerTimes(Long, Map)
. A value of -1 means there is no start time.- Specified by:
getStartTimeInMillis
in interfaceIrisScheduler
- 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 afterIrisScheduler.generateSchedulerTimes(Long, Map)
. A value of -1 means there is no stop time.- Specified by:
getStopTimeInMillis
in interfaceIrisScheduler
- 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 interfaceIrisScheduler
- 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 interfaceIrisScheduler
- 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 interfaceIrisScheduler
- 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 interfaceIrisScheduler
- Returns:
- true if the query should be restarted when its dependent-on condition is met
-
getStartTimeDisplay
- Specified by:
getStartTimeDisplay
in interfaceIrisScheduler
-
getStopTimeDisplay
- Specified by:
getStopTimeDisplay
in interfaceIrisScheduler
-
getTimeZoneDisplay
- Specified by:
getTimeZoneDisplay
in interfaceIrisScheduler
-
getRepeatInterval
public long getRepeatInterval()Description copied from interface:IrisScheduler
Return the repeat interval in minutes.- Specified by:
getRepeatInterval
in interfaceIrisScheduler
- 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 interfaceIrisScheduler
- 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 interfaceIrisScheduler
- 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 interfaceIrisScheduler
- Returns:
- true if the determined start time is the first possible one for the day, false otherwise
-
validate
Description copied from interface:IrisScheduler
Validate the scheduling.- Specified by:
validate
in interfaceIrisScheduler
- 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 interfaceIrisScheduler
- Returns:
- if this scheduler is overnight
-
isStopTimeDisabled
protected final boolean isStopTimeDisabled()
-