Class JobUtils

java.lang.Object
net.solarnetwork.node.job.JobUtils

public class JobUtils extends Object
Utility methods for working with scheduled jobs.
Since:
1.71
Version:
2.0
Author:
matt
  • Field Details

    • CRON_PLAIN_SECOND_FIELD_PATTERN

      public static final Pattern CRON_PLAIN_SECOND_FIELD_PATTERN
      A pattern to match a digit-only second field number value.
  • Constructor Details

    • JobUtils

      public JobUtils()
  • Method Details

    • triggerForExpression

      public static org.springframework.scheduling.Trigger triggerForExpression(String expression, TimeUnit timeUnit, boolean randomized)
      Create a trigger from a schedule expression.

      The expression can be either an integer number representing a timeUnit frequency or else a cron expression. If randomize is true then if the cron expression seconds value is a constant value it

      Parameters:
      expression - the schedule expression
      timeUnit - the time unit to use for periodic triggers
      randomized - true to randomize the second field of cron triggers
      Returns:
      the trigger, or null if the expression cannot be parsed into one
      Since:
      2.0