Interface SchedulerService

All Superinterfaces:
Service

public interface SchedulerService
extends Service
Allows for the scheduling/cancellation of batch jobs.
  • Method Summary

    Modifier and Type Method Description
    void addSchedules​(ScheduleEntry... entryDef)
    Add schedules and generate tasks to run based on the schedule.
    void addSchedules​(java.util.Collection<ScheduleEntry> schedules)
    Add schedules and generate tasks to run based on the schedule.
    void disableGroupUntil​(java.lang.String groupName, java.util.Date time)
    Disable all schedules within the group until the specified time.
    void disableScheduleUntil​(java.lang.String groupName, java.lang.String scheduleName, java.util.Date time)
    Disable a schedule under the specified group until the specified time.
    void enableGroup​(java.lang.String groupName)
    Enable all schedules in a group.
    void enableSchedule​(java.lang.String groupName, java.lang.String scheduleName)
    Enable the schedule so that the schedule can run.
    ComplexSchedule newComplexSchedule()
    Creates ComplexSchedule in memory to be added to the ScheduleEntry.
    ListParam newListParam​(java.lang.String name, java.util.List<java.lang.String> values)
    Create a named parameter with multiple values.
    OnceOnlySchedule newOnceOnlySchedule​(java.util.Calendar executionTime)
    Creates OnceOnlySchedule in memory to be added to the ScheduleEntry.
    Param newParam​(java.lang.String name, java.lang.String val)
    Create a named parameter with a single value.
    RepeatingSchedule newRepeatingSchedule​(int intervalInSeconds)
    Creates RepeatingSchedule in memory to be added to the ScheduleEntry.
    ScheduleEntry newScheduleEntry()
    Creates the ScheduleEntry in memory, to which schedules to be added which can be persisted.
    void removeGroup​(java.lang.String groupName)
    Permanently remove all schedules defined under the specified group.
    void removeSchedule​(java.lang.String groupName, java.lang.String scheduleName)
    Permanently remove the specified schedule.
    void runAndAwait​(java.lang.String groupName, java.lang.String scheduleName, long waitIntervalInMillis, long maxAwaitInMillis)
    Run the given schedule's Runnable immediately, regardless of when it is intended to run and wait for it to finish.
    void runNow​(java.lang.String groupName, java.lang.String scheduleName)
    Run the given schedule's Runnable immediately, regardless of when it is intended to run.
  • Method Details

    • addSchedules

      void addSchedules​(ScheduleEntry... entryDef)
      Add schedules and generate tasks to run based on the schedule.
      Parameters:
      entryDef - Schedule entries to be persisted
    • addSchedules

      void addSchedules​(java.util.Collection<ScheduleEntry> schedules)
      Add schedules and generate tasks to run based on the schedule.
      Parameters:
      schedules - list of ScheduleEntry to be persisted and for which GridTask to be created.
    • disableGroupUntil

      void disableGroupUntil​(java.lang.String groupName, java.util.Date time)
      Disable all schedules within the group until the specified time.
      Parameters:
      groupName - group under which schedules are defined
      time - disable until this Date
    • disableScheduleUntil

      void disableScheduleUntil​(java.lang.String groupName, java.lang.String scheduleName, java.util.Date time)
      Disable a schedule under the specified group until the specified time.
      Parameters:
      groupName - group under which schedule is defined to disable
      scheduleName - name of the schedule to be disabled
      time - disable until this Date
    • enableGroup

      void enableGroup​(java.lang.String groupName)
      Enable all schedules in a group. If any of the schedules were disabled, remove the disabling and reschedule the task.
      Parameters:
      groupName - the group name under which schedules to be enabled
    • enableSchedule

      void enableSchedule​(java.lang.String groupName, java.lang.String scheduleName)
      Enable the schedule so that the schedule can run.
      Parameters:
      groupName - GroupName under which schedule is defined
      scheduleName - name of schedule to be enabled.
    • runNow

      void runNow​(java.lang.String groupName, java.lang.String scheduleName)
      Run the given schedule's Runnable immediately, regardless of when it is intended to run.
      Parameters:
      groupName - group under which schedule is defined
      scheduleName - name of the schedule to run immediately
    • runAndAwait

      void runAndAwait​(java.lang.String groupName, java.lang.String scheduleName, long waitIntervalInMillis, long maxAwaitInMillis) throws GridTaskWaitException
      Run the given schedule's Runnable immediately, regardless of when it is intended to run and wait for it to finish.
      Parameters:
      groupName - group under which schedule is defined
      scheduleName - name of the schedule to run immediately
      waitIntervalInMillis - how often to check if the scheduled runnable finished execution
      maxAwaitInMillis - total time to wait for the runnable to finish execution. If it does not complete the work, it will
      Throws:
      GridTaskWaitException
    • removeGroup

      void removeGroup​(java.lang.String groupName)
      Permanently remove all schedules defined under the specified group.
      Parameters:
      groupName - GroupName to remove all schedules
    • removeSchedule

      void removeSchedule​(java.lang.String groupName, java.lang.String scheduleName)
      Permanently remove the specified schedule.
      Parameters:
      groupName - name of the group under which schedule is defined
      scheduleName - name of the schedule to be removed
    • newScheduleEntry

      ScheduleEntry newScheduleEntry()
      Creates the ScheduleEntry in memory, to which schedules to be added which can be persisted.
      Returns:
      new SchduleEntry
    • newOnceOnlySchedule

      OnceOnlySchedule newOnceOnlySchedule​(java.util.Calendar executionTime)
      Creates OnceOnlySchedule in memory to be added to the ScheduleEntry. OnceOnlySchedule will run exactly once at the given date & time.
      Parameters:
      executionTime - Date & time at which schedule run
      Returns:
      new ComplexSchedule
    • newComplexSchedule

      ComplexSchedule newComplexSchedule()
      Creates ComplexSchedule in memory to be added to the ScheduleEntry. N number of ComplexScheduleElement(s) can be added to this schedule.
      Returns:
      new ComplexSchedule
    • newRepeatingSchedule

      RepeatingSchedule newRepeatingSchedule​(int intervalInSeconds)
      Creates RepeatingSchedule in memory to be added to the ScheduleEntry. RepeatingSchedule repeats every N seconds.
      Parameters:
      intervalInSeconds - interval in seconds at which the schedule repeats.
      Returns:
      new RepeatingSchedule
    • newParam

      Param newParam​(java.lang.String name, java.lang.String val)
      Create a named parameter with a single value.
      Parameters:
      name - parameter name
      val - parameter value
      Returns:
      new Param
    • newListParam

      ListParam newListParam​(java.lang.String name, java.util.List<java.lang.String> values)
      Create a named parameter with multiple values.
      Parameters:
      name - parameter name
      values - parameter values
      Returns:
      new ListParam