Class JobSchedule

java.lang.Object
com.sodius.oslc.server.core.jobs.JobSchedule
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
JobSchedule.FixedDelaySchedule, JobSchedule.FixedRateSchedule

public abstract class JobSchedule extends Object implements Serializable
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:
  • Method Details

    • atFixedRate

      public static JobSchedule.FixedRateSchedule atFixedRate(int hour, int minute)
      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 run
      minute - 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 cluster job 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 immediately
      delay - the delay between the termination of one execution and the commencement of the next
      unit - the unit of time for the two delay values
      Returns:
      a job schedule
      Throws:
      NullPointerException - if unit is null
      IllegalArgumentException - if delay is not a positive number
    • disabled

      public static JobSchedule disabled()
      Indicates the job is disabled and shall not run. This method is convenient to suspend executions of jobs.
      Returns:
      a job schedule
    • getType

      public abstract JobSchedule.Type getType()
      Returns the type of scheduling.
      Returns:
      the type of scheduling.
    • hashCode

      public abstract int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public abstract boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getDescription

      public abstract String 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

      public final String toString()
      Overrides:
      toString in class Object