Class CronUtils


  • public class CronUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      CronUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String buildCronFromOriginal​(long startTime, java.lang.String zoneId)
      Helper method to take a start time in millis from epoch create cron expression.
      static java.lang.String buildCronFromOriginalAllDays​(long startTime, java.lang.String zoneId)
      Helper method to take a start time in millis from epoch create cron expression that also runs on all days, months and years
      static java.lang.String buildCronFromOriginalWithMillisecondOffset​(long startTime, long offset, java.lang.String zoneId)
      Helper method to take a start time in millis from epoch, add an offset to it and a zone context, and return a relevant quartz cron expressions that represents the offset time.
      static long getEpochMilliOfNextFireTime​(java.lang.String cronExpression)
      Get the epoch in milliseconds of next fire time for cron expression.
      static long getEpochMilliOfNextFireTimeAccountingForBlackoutWindow​(java.lang.String cronExpression, java.util.List<java.lang.String> blackoutCronExpressions, java.util.Map<java.lang.Long,​java.lang.Long> blackoutWindowDateTimeRanges, java.lang.String timezone)
      Get the epoch in milliseconds of next fire time for cron expression.
      static long getEpochMilliOfPreviousFireTime​(java.lang.String cronExpression)
      Get the epoch in milliseconds of next fire time for cron expression.
      static boolean isDurationGreaterThanNextFireTime​(java.lang.String cronExpression, long duration, int intervalMultiplier)
      This method is aimed to provide some sensible constraints on how frequently jobs plans are created and what their duration is relative to the frequency of their creation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CronUtils

        public CronUtils()
    • Method Detail

      • buildCronFromOriginalWithMillisecondOffset

        public static java.lang.String buildCronFromOriginalWithMillisecondOffset​(long startTime,
                                                                                  long offset,
                                                                                  java.lang.String zoneId)
        Helper method to take a start time in millis from epoch, add an offset to it and a zone context, and return a relevant quartz cron expressions that represents the offset time.
        Parameters:
        startTime -
        offset -
        zoneId -
        Returns:
      • buildCronFromOriginal

        public static java.lang.String buildCronFromOriginal​(long startTime,
                                                             java.lang.String zoneId)
        Helper method to take a start time in millis from epoch create cron expression.
        Parameters:
        startTime -
        zoneId -
        Returns:
      • buildCronFromOriginalAllDays

        public static java.lang.String buildCronFromOriginalAllDays​(long startTime,
                                                                    java.lang.String zoneId)
        Helper method to take a start time in millis from epoch create cron expression that also runs on all days, months and years
        Parameters:
        startTime -
        zoneId -
        Returns:
      • isDurationGreaterThanNextFireTime

        public static boolean isDurationGreaterThanNextFireTime​(java.lang.String cronExpression,
                                                                long duration,
                                                                int intervalMultiplier)
        This method is aimed to provide some sensible constraints on how frequently jobs plans are created and what their duration is relative to the frequency of their creation.
        Parameters:
        cronExpression -
        duration -
        intervalMultiplier -
        Returns:
      • getEpochMilliOfNextFireTime

        public static long getEpochMilliOfNextFireTime​(java.lang.String cronExpression)
        Get the epoch in milliseconds of next fire time for cron expression.
        Parameters:
        cronExpression -
        Returns:
      • getEpochMilliOfPreviousFireTime

        public static long getEpochMilliOfPreviousFireTime​(java.lang.String cronExpression)
        Get the epoch in milliseconds of next fire time for cron expression.
        Parameters:
        cronExpression -
        Returns:
      • getEpochMilliOfNextFireTimeAccountingForBlackoutWindow

        public static long getEpochMilliOfNextFireTimeAccountingForBlackoutWindow​(java.lang.String cronExpression,
                                                                                  java.util.List<java.lang.String> blackoutCronExpressions,
                                                                                  java.util.Map<java.lang.Long,​java.lang.Long> blackoutWindowDateTimeRanges,
                                                                                  java.lang.String timezone)
        Get the epoch in milliseconds of next fire time for cron expression.
        Parameters:
        cronExpression -
        Returns: