Class JobTriggerProvider


  • public class JobTriggerProvider
    extends Object
    A factory of job triggers. This factory creates the specific job triggers depending upons the scheduling parameters.
    • Method Detail

      • getJobTriggerWithPeriodicity

        public static FixedPeriodJobTrigger getJobTriggerWithPeriodicity​(int time,
                                                                         TimeUnit unit)
        Creates a new job trigger that will fire a job execution at the specified regular time.
        Parameters:
        time - the time between each job triggering.
        unit - the unit in which the time is expressed.
        Returns:
        a job trigger whose type depends upon the specified periodicity.
      • getJobTriggerWithCronExpression

        public static CronJobTrigger getJobTriggerWithCronExpression​(String cron)
                                                              throws ParseException
        Creates a new job trigger that will fire a job execution at given moments in the time, as defined by the specified cron expression.
        Parameters:
        cron - the Unix cron-like expression.
        Returns:
        a CronJobTrigger instance.
        Throws:
        ParseException - if the specified cron expression is not valid.
        See Also:
        CronJobTrigger
      • getJobTriggerAtDateTime

        public static FixedDateTimeJobTrigger getJobTriggerAtDateTime​(OffsetDateTime dateTime)
        Creates a new job trigger that will fire a job execution at the specified date time.
        Parameters:
        dateTime - an OffsetDateTime value.
        Returns:
        the one shot job trigger.