Package com.sodius.oslc.server.core.jobs
Class JobSchedule
java.lang.Object
com.sodius.oslc.server.core.jobs.JobSchedule
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
JobSchedule.FixedDelaySchedule,JobSchedule.FixedRateSchedule
Provides information on how to schedule a job.
Jobs can be scheduled either at a fixed rate
or with a fixed delay.
A job can also be disabled, to suspend executions.
- Since:
- 3.11.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classProvides information for a job to schedule with a fixed delay.static final classProvides information for a job to schedule at a fixed rate.static enumDetermines the type of schedule. -
Method Summary
Modifier and TypeMethodDescriptionatFixedRate(int hour, int minute) Indicates the job is to run at fixed rate, at given hour and minute, each day.static JobScheduledisabled()Indicates the job is disabled and shall not run.abstract booleanabstract StringReturns a description of the schedule, for end-user understanding, typically inserted in audit events.abstract JobSchedule.TypegetType()Returns the type of scheduling.abstract inthashCode()final StringtoString()withFixedDelay(long initialDelay, long delay, TimeUnit unit) Indicates the job is to run periodically with a given delay between the termination of one execution and the commencement of the next.
-
Method Details
-
atFixedRate
Indicates the job is to run at fixed rate, at given hour and minute, each day.- Parameters:
hour- the hour (0 to 23) at which the job must runminute- the minute (0 to 59) at which the job must run- Returns:
- a job schedule
- Throws:
IllegalArgumentException- if hour and minute values are out of range
-
withFixedDelay
public static JobSchedule.FixedDelaySchedule withFixedDelay(long initialDelay, long delay, TimeUnit unit) Indicates the job is to run periodically with a given delay between the termination of one execution and the commencement of the next.Note a
clusterjob cannot use a fixed delay schedule.- Parameters:
initialDelay- the initial delay before running the job, 0 or a negative number if the job must run immediatelydelay- the delay between the termination of one execution and the commencement of the nextunit- the unit of time for the two delay values- Returns:
- a job schedule
- Throws:
NullPointerException- if unit is nullIllegalArgumentException- if delay is not a positive number
-
disabled
Indicates the job is disabled and shall not run. This method is convenient to suspend executions of jobs.- Returns:
- a job schedule
-
getType
Returns the type of scheduling.- Returns:
- the type of scheduling.
-
hashCode
public abstract int hashCode() -
equals
-
getDescription
Returns a description of the schedule, for end-user understanding, typically inserted in audit events.- Returns:
- a description of the schedule
- Since:
- 3.12.0
-
toString
-