Package com.illumon.iris.controller
Interface IrisScheduler
- All Known Implementing Classes:
IrisQueryScheduler,IrisQuerySchedulerContinuous,IrisQuerySchedulerDaily,IrisQuerySchedulerDependent,IrisQuerySchedulerMonthly,IrisQuerySchedulerTemporary
public interface IrisScheduler
Interface for any Iris Scheduling implementation
IrisScheduler is intended to store scheduling information for Iris persistent queries. However the scheduler itself
is not stored directly in the queries; instead a String[] representation of the detail is stored, as this makes
serialization and display easier. Therefore each implementation needs to be able to generate itself from a String[]
representation, and generate a String[] representation from itself.
Each String[] representation must include as its first item the IrisScheduler implementation that will be instantiated
when the strings are parsed. This will be done by the IrisSchedulerFactory class, which should always be used
to create an IrisScheduler instance.
-
Field Summary
Fields Modifier and Type Field Description static StringDELIMITER_TOKENstatic StringSCHEDULER_TYPE_TOKEN -
Method Summary
Modifier and Type Method Description default booleanareConditionsMet()Check if the dependency conditions for running have been met.voidgenerateSchedulerTimes(Long lookPastTime, Map<Long,PersistentQueryInfo> queryInfos)Generate the next start/stop time values for this query.String[]generateStringArrayFromScheduler()default List<Long>getDependentOnQuerySerials()Return the list of query serials on which this query is dependent.default longgetExpirationTimeMillis()For a temporary query, return the query's expiration time in millis.longgetRepeatInterval()Return the repeat interval in minutes.intgetRestartDelayMinutes()Indicate how many minutes to delay between failed query restart attempts.intgetRestartErrorCount()Indicate how many times a failed query should be restarted.default booleangetRunOnFailure()For a dependent query, indicates whether the query should run after a failure instead of after a success.StringgetScheduleDetailDisplay(String[] strings, Map<Long,PersistentQueryInfo> queryInfos)booleangetSchedulingDisabled()Return true if scheduling is disabled.StringgetStartTimeDisplay(String[] strings)longgetStartTimeInMillis()Return the scheduler's next scheduled start time.LocalTimegetStartTimeOfDay()Get the schedulers start time as a general time of day.StringgetStopTimeDisplay(String[] strings)longgetStopTimeInMillis()Return the scheduler's next scheduled stop time.LocalTimegetStopTimeOfDay()Get the scheduler's stop time as a general time of day.default StringgetTemporaryQueueName()For a temporary query, return the temporary queue name.StringgetTimeZoneDisplay(String[] strings)StringgetTimeZoneString()Get the time zone string that is used for allLocalTimesbooleanhasStopTime()Return true if the scheduling has a determinable stop time.booleanisOvernight()Indicate if this scheduler is overnight.booleanisRepeatEnabled()Return true if the scheduling has repeat-interval enabled.booleanisStartTimeFirstForDay()Return true if the determined start time is the first possible one for the day.voidpopulateSchedulerFromStringArray(String[] strings)default voidsetDependentOnQuerySerials(List<Long> newDependentOnQuerySerials)Set the dependent-on query serials.default booleanshouldRestartWhenRunning()Indicates whether a query should be restarted by the scheduler when running.booleanskipIfUnsuccessful()Return true if the query scheduling should be skipped if the previous run was unsuccessful.default booleanupdateDependencyState(PersistentQueryState state)For a dependent query, update the dependency state with the passed in state, and indicate if all required dependencies have been met.default booleanupdateDependencyState(Long serial, PersistentQueryState.Status status)For a dependent query, update the dependency state with the passed in state, and indicate if all required dependencies have been met.voidvalidate(Map<Long,PersistentQueryInfo> allConfigurations)Validate the scheduling.
-
Field Details
-
SCHEDULER_TYPE_TOKEN
- See Also:
- Constant Field Values
-
DELIMITER_TOKEN
- See Also:
- Constant Field Values
-
-
Method Details
-
generateStringArrayFromScheduler
String[] generateStringArrayFromScheduler() -
populateSchedulerFromStringArray
-
getStartTimeDisplay
-
getStopTimeDisplay
-
getTimeZoneDisplay
-
getScheduleDetailDisplay
-
generateSchedulerTimes
Generate the next start/stop time values for this query. Generated values of -1 will be used to indicate no start or stop time. After calling this, calling getStartTimeInMillis will return the generated start time and calling getStopTimeInMillis will return the generated stop time.- Parameters:
lookPastTime- the time in millis past which the scheduling engine looks for the next start time, or null if none is desiredqueryInfos- the controller's query information Map
-
getStartTimeInMillis
long getStartTimeInMillis()Return the scheduler's next scheduled start time. This must be called aftergenerateSchedulerTimes(Long, Map). A value of -1 means there is no start time.- Returns:
- the query's next start time in millis
-
getStartTimeOfDay
LocalTime getStartTimeOfDay()Get the schedulers start time as a general time of day. Note that this is not the next absolute start time given bygetStartTimeInMillis()- Returns:
- a
LocalTimerepresenting the start time of the query
-
getStopTimeInMillis
long getStopTimeInMillis()Return the scheduler's next scheduled stop time. This must be called aftergenerateSchedulerTimes(Long, Map). A value of -1 means there is no stop time.- Returns:
- the query's next start time in millis
-
getStopTimeOfDay
LocalTime getStopTimeOfDay()Get the scheduler's stop time as a general time of day.- Returns:
- the stop time of the query, if there was one, or null
-
getTimeZoneString
String getTimeZoneString()Get the time zone string that is used for allLocalTimes- Returns:
- the time zone string
-
getSchedulingDisabled
boolean getSchedulingDisabled()Return true if scheduling is disabled.- Returns:
- true if scheduling is disabled, false if scheduling is enabled.
-
hasStopTime
boolean hasStopTime()Return true if the scheduling has a determinable stop time.- Returns:
- true if the scheduling has a determinable stop time, false otherwise
-
isRepeatEnabled
boolean isRepeatEnabled()Return true if the scheduling has repeat-interval enabled.- Returns:
- true if the scheduling has repeat-interval enabled, false otherwise
-
skipIfUnsuccessful
boolean skipIfUnsuccessful()Return true if the query scheduling should be skipped if the previous run was unsuccessful.- Returns:
- true if the query scheduling should be skipped if the previous run was unsuccessful, false otherwise
-
getRepeatInterval
long getRepeatInterval()Return the repeat interval in minutes.- Returns:
- the repeat interval in minutes.
-
isStartTimeFirstForDay
boolean isStartTimeFirstForDay()Return true if the determined start time is the first possible one for the day.- Returns:
- true if the determined start time is the first possible one for the day, false otherwise
-
validate
void validate(Map<Long,PersistentQueryInfo> allConfigurations) throws PersistentQueryConfiguration.ValidationFailureValidate the scheduling.- Parameters:
allConfigurations- a map of all current query configurations which can be used for additional validation- Throws:
PersistentQueryConfiguration.ValidationFailure- if the scheduling is not valid
-
getRunOnFailure
default boolean getRunOnFailure()For a dependent query, indicates whether the query should run after a failure instead of after a success.- Returns:
- true if the dependency is for failed dependent-on runs, false if it's for Running/Completed conditions
-
shouldRestartWhenRunning
default boolean shouldRestartWhenRunning()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)
- Returns:
- true if the query should be restarted when its dependent-on condition is met
-
getDependentOnQuerySerials
Return the list of query serials on which this query is dependent.- Returns:
- the dependent-on query serial list, or null if this is not a dependent query
-
setDependentOnQuerySerials
Set the dependent-on query serials. For example, this may be done when importing queries from another controller.- Parameters:
newDependentOnQuerySerials- the new dependency list
-
updateDependencyState
For a dependent query, update the dependency state with the passed in state, and indicate if all required dependencies have been met.- Parameters:
state- the state of the dependency query- Returns:
- true if all required dependency conditions are met for this query
-
updateDependencyState
For a dependent query, update the dependency state with the passed in state, and indicate if all required dependencies have been met.- Parameters:
serial- the serial of the dependency querystatus- the status of the dependency query- Returns:
- true if all required dependency conditions are met for this query
-
areConditionsMet
default boolean areConditionsMet()Check if the dependency conditions for running have been met.- Returns:
- true if the query has met it dependency conditions
-
getTemporaryQueueName
For a temporary query, return the temporary queue name.- Returns:
- the queue name, or null if it is not a temporary query
-
getExpirationTimeMillis
default long getExpirationTimeMillis()For a temporary query, return the query's expiration time in millis.- Returns:
- the query's expiration time in millis (i.e. the time from which it completes until it should be deleted)
-
getRestartErrorCount
int getRestartErrorCount()Indicate how many times a failed query should be restarted.- Returns:
- the number of times a failed query restart attempt should be made
-
getRestartDelayMinutes
int getRestartDelayMinutes()Indicate how many minutes to delay between failed query restart attempts.- Returns:
- the number of minutes to delay between failed query restart attempts
-
isOvernight
boolean isOvernight()Indicate if this scheduler is overnight.- Returns:
- if this scheduler is overnight
-