Class RecurringTask


  • public class RecurringTask
    extends Object
    This class defines a information about a recurring task, which will be used to repeatedly schedule tasks for processing.
    It also provides some static methods that allow to validate strings in crontab (5) format.
    • Constructor Detail

      • RecurringTask

        public RecurringTask​(ServerContext serverContext,
                             TaskScheduler taskScheduler,
                             Entry recurringTaskEntry)
                      throws LdapException
        Creates a new recurring task based on the information in the provided entry.
        Parameters:
        serverContext - The server context.
        taskScheduler - A reference to the task scheduler that may be used to schedule new tasks.
        recurringTaskEntry - The entry containing the information to use to define the task to process.
        Throws:
        LdapException - If the provided entry does not contain a valid recurring task definition.
    • Method Detail

      • getRecurringTaskID

        public String getRecurringTaskID()
        Retrieves the unique ID assigned to this recurring task.
        Returns:
        The unique ID assigned to this recurring task.
      • getRecurringTaskEntry

        public Entry getRecurringTaskEntry()
        Retrieves the entry containing the data for this recurring task.
        Returns:
        The entry containing the data for this recurring task.
      • scheduleNextIteration

        public Task scheduleNextIteration​(Instant dateAndTimeToSchedule)
                                   throws LdapException
        Schedules the next iteration of this recurring task for processing.
        Parameters:
        dateAndTimeToSchedule - date and time to schedule next iteration from.
        Returns:
        The task that has been scheduled for processing.
        Throws:
        LdapException - to indicate an error.
      • parseTaskTab

        public static void parseTaskTab​(String taskSchedule)
                                 throws LdapException
        Parse and validate recurring task schedule.
        Parameters:
        taskSchedule - recurring task schedule tab in crontab(5) format.
        Throws:
        LdapException - to indicate an error.