azkaban.utils.Utils.parseCronExpression()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中azkaban.utils.Utils.parseCronExpression()方法的一些代码示例,展示了Utils.parseCronExpression()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.parseCronExpression()方法的具体详情如下:
包路径:azkaban.utils.Utils
类名称:Utils
方法名:parseCronExpression

Utils.parseCronExpression介绍

暂无

代码示例

代码示例来源:origin: azkaban/azkaban

public BasicTimeChecker(final String id, final long firstCheckTime,
  final DateTimeZone timezone, final long nextCheckTime, final boolean isRecurring,
  final boolean skipPastChecks, final ReadablePeriod period, final String cronExpression) {
 this.id = id;
 this.firstCheckTime = firstCheckTime;
 this.timezone = timezone;
 this.nextCheckTime = nextCheckTime;
 this.isRecurring = isRecurring;
 this.skipPastChecks = skipPastChecks;
 this.period = period;
 this.cronExpression = cronExpression;
 this.cronExecutionTime = Utils.parseCronExpression(cronExpression, timezone);
}

代码示例来源:origin: azkaban/azkaban

public BasicTimeChecker(final String id, final long firstCheckTime,
  final DateTimeZone timezone, final boolean isRecurring, final boolean skipPastChecks,
  final ReadablePeriod period, final String cronExpression) {
 this.id = id;
 this.firstCheckTime = firstCheckTime;
 this.timezone = timezone;
 this.isRecurring = isRecurring;
 this.skipPastChecks = skipPastChecks;
 this.period = period;
 this.nextCheckTime = firstCheckTime;
 this.cronExpression = cronExpression;
 this.cronExecutionTime = Utils.parseCronExpression(cronExpression, timezone);
 this.nextCheckTime = calculateNextCheckTime();
}

代码示例来源:origin: azkaban/azkaban

/**
 * @return if the cronExpression is valid or not.
 */
public static boolean isCronExpressionValid(final String cronExpression,
  final DateTimeZone timezone) {
 if (!CronExpression.isValidExpression(cronExpression)) {
  return false;
 }
 /*
  * The below code is aimed at checking some cases that the above code can not identify,
  * e.g. <0 0 3 ? * * 22> OR <0 0 3 ? * 8>. Under these cases, the below code is able to tell.
  */
 final CronExpression cronExecutionTime = parseCronExpression(cronExpression, timezone);
 if (cronExecutionTime == null || cronExecutionTime.getNextValidTimeAfter(new Date()) == null) {
  return false;
 }
 return true;
}

代码示例来源:origin: azkaban/azkaban

public boolean updateTime() {
 if (new DateTime(this.nextExecTime).isAfterNow()) {
  return true;
 }
 if (this.cronExpression != null) {
  final DateTime nextTime = getNextCronRuntime(
    this.nextExecTime, this.timezone, Utils.parseCronExpression(this.cronExpression,
      this.timezone));
  this.nextExecTime = nextTime.getMillis();
  return true;
 }
 if (this.period != null) {
  final DateTime nextTime = getNextRuntime(this.nextExecTime, this.timezone, this.period);
  this.nextExecTime = nextTime.getMillis();
  return true;
 }
 return false;
}

代码示例来源:origin: com.linkedin.azkaban/azkaban-common

public BasicTimeChecker(final String id, final long firstCheckTime,
  final DateTimeZone timezone, final long nextCheckTime, final boolean isRecurring,
  final boolean skipPastChecks, final ReadablePeriod period, final String cronExpression) {
 this.id = id;
 this.firstCheckTime = firstCheckTime;
 this.timezone = timezone;
 this.nextCheckTime = nextCheckTime;
 this.isRecurring = isRecurring;
 this.skipPastChecks = skipPastChecks;
 this.period = period;
 this.cronExpression = cronExpression;
 this.cronExecutionTime = Utils.parseCronExpression(cronExpression, timezone);
}

代码示例来源:origin: com.linkedin.azkaban/azkaban-common

public BasicTimeChecker(final String id, final long firstCheckTime,
  final DateTimeZone timezone, final boolean isRecurring, final boolean skipPastChecks,
  final ReadablePeriod period, final String cronExpression) {
 this.id = id;
 this.firstCheckTime = firstCheckTime;
 this.timezone = timezone;
 this.isRecurring = isRecurring;
 this.skipPastChecks = skipPastChecks;
 this.period = period;
 this.nextCheckTime = firstCheckTime;
 this.cronExpression = cronExpression;
 this.cronExecutionTime = Utils.parseCronExpression(cronExpression, timezone);
 this.nextCheckTime = calculateNextCheckTime();
}

代码示例来源:origin: com.linkedin.azkaban/az-core

public static boolean isCronExpressionValid(final String cronExpression,
  final DateTimeZone timezone) {
 if (!CronExpression.isValidExpression(cronExpression)) {
  return false;
 }
 /*
  * The below code is aimed at checking some cases that the above code can not identify,
  * e.g. <0 0 3 ? * * 22> OR <0 0 3 ? * 8>. Under these cases, the below code is able to tell.
  */
 final CronExpression cronExecutionTime = parseCronExpression(cronExpression, timezone);
 if (cronExecutionTime == null || cronExecutionTime.getNextValidTimeAfter(new Date()) == null) {
  return false;
 }
 return true;
}

代码示例来源:origin: com.linkedin.azkaban/azkaban-common

public boolean updateTime() {
 if (new DateTime(this.nextExecTime).isAfterNow()) {
  return true;
 }
 if (this.cronExpression != null) {
  final DateTime nextTime = getNextCronRuntime(
    this.nextExecTime, this.timezone, Utils.parseCronExpression(this.cronExpression,
      this.timezone));
  this.nextExecTime = nextTime.getMillis();
  return true;
 }
 if (this.period != null) {
  final DateTime nextTime = getNextRuntime(this.nextExecTime, this.timezone, this.period);
  this.nextExecTime = nextTime.getMillis();
  return true;
 }
 return false;
}

相关文章