org.quartz.CronTrigger.getFireTimeAfter()方法的使用及代码示例

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

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

CronTrigger.getFireTimeAfter介绍

[英]Returns the next time at which the CronTrigger will fire, after the given time. If the trigger will not fire after the given time, null will be returned.

Note that the date returned is NOT validated against the related org.quartz.Calendar (if any)
[中]返回给定时间后CronTrigger将触发的下一次时间。如果触发器在给定时间后不会触发,则返回null
请注意,返回的日期未针对相关组织进行验证。石英日历(如有)

代码示例

代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz

  1. /**
  2. * <p>
  3. * Called when the <code>{@link Scheduler}</code> has decided to 'fire'
  4. * the trigger (execute the associated <code>Job</code>), in order to
  5. * give the <code>Trigger</code> a chance to update itself for its next
  6. * triggering (if any).
  7. * </p>
  8. *
  9. * @see #executionComplete(JobExecutionContext, JobExecutionException)
  10. */
  11. public void triggered(org.quartz.Calendar calendar) {
  12. previousFireTime = nextFireTime;
  13. nextFireTime = getFireTimeAfter(nextFireTime);
  14. while (nextFireTime != null && calendar != null
  15. && !calendar.isTimeIncluded(nextFireTime.getTime())) {
  16. nextFireTime = getFireTimeAfter(nextFireTime);
  17. }
  18. }

代码示例来源:origin: quartz/quartz-all

  1. /**
  2. * <p>
  3. * Called when the <code>{@link Scheduler}</code> has decided to 'fire'
  4. * the trigger (execute the associated <code>Job</code>), in order to
  5. * give the <code>Trigger</code> a chance to update itself for its next
  6. * triggering (if any).
  7. * </p>
  8. *
  9. * @see #executionComplete(JobExecutionContext, JobExecutionException)
  10. */
  11. public void triggered(org.quartz.Calendar calendar) {
  12. previousFireTime = nextFireTime;
  13. nextFireTime = getFireTimeAfter(nextFireTime);
  14. while (nextFireTime != null && calendar != null
  15. && !calendar.isTimeIncluded(nextFireTime.getTime())) {
  16. nextFireTime = getFireTimeAfter(nextFireTime);
  17. }
  18. }

代码示例来源:origin: stackoverflow.com

  1. CronTrigger cal = new CronTrigger("Test", "Test", "0 0/10 * * * ?" );
  2. ...
  3. end = start + 1000000;
  4. ...
  5. while (current < end) {
  6. if (i > 0) {
  7. System.out.println(i + ":" + current);
  8. }
  9. Date next = cal.getFireTimeAfter(new Date(current));
  10. current = next.getTime();
  11. i++;
  12. }

代码示例来源:origin: quartz/quartz-all

  1. nextFireTime = getFireTimeAfter(previousFireTime);
  2. while (nextFireTime != null && !calendar.isTimeIncluded(nextFireTime.getTime())) {
  3. nextFireTime = getFireTimeAfter(nextFireTime);
  4. long diff = now.getTime() - nextFireTime.getTime();
  5. if(diff >= misfireThreshold) {
  6. nextFireTime = getFireTimeAfter(nextFireTime);
  7. continue;

代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz

  1. nextFireTime = getFireTimeAfter(previousFireTime);
  2. while (nextFireTime != null && !calendar.isTimeIncluded(nextFireTime.getTime())) {
  3. nextFireTime = getFireTimeAfter(nextFireTime);
  4. long diff = now.getTime() - nextFireTime.getTime();
  5. if(diff >= misfireThreshold) {
  6. nextFireTime = getFireTimeAfter(nextFireTime);
  7. continue;

代码示例来源:origin: quartz/quartz-all

  1. /**
  2. * <p>
  3. * Called by the scheduler at the time a <code>Trigger</code> is first
  4. * added to the scheduler, in order to have the <code>Trigger</code>
  5. * compute its first fire time, based on any associated calendar.
  6. * </p>
  7. *
  8. * <p>
  9. * After this method has been called, <code>getNextFireTime()</code>
  10. * should return a valid answer.
  11. * </p>
  12. *
  13. * @return the first time at which the <code>Trigger</code> will be fired
  14. * by the scheduler, which is also the same value <code>getNextFireTime()</code>
  15. * will return (until after the first firing of the <code>Trigger</code>).
  16. * </p>
  17. */
  18. public Date computeFirstFireTime(org.quartz.Calendar calendar) {
  19. nextFireTime = getFireTimeAfter(new Date(getStartTime().getTime() - 1000l));
  20. while (nextFireTime != null && calendar != null
  21. && !calendar.isTimeIncluded(nextFireTime.getTime())) {
  22. nextFireTime = getFireTimeAfter(nextFireTime);
  23. }
  24. return nextFireTime;
  25. }

代码示例来源:origin: com.salesforce.argus/argus-core

  1. public static List<Alert> getEnabledAlertsForMinute(long minuteStartTimeMillis){
  2. List<Alert> enabledAlerts = new ArrayList<Alert>();
  3. List<BigInteger> enabledAlertIds = new ArrayList<BigInteger>();
  4. for(String cronEntry : alertsMapByCronEntry.keySet()) {
  5. try {
  6. String quartzCronEntry = Cron.convertToQuartzCronEntry(cronEntry);
  7. CronTrigger cronTrigger = TriggerBuilder.newTrigger().withSchedule(CronScheduleBuilder.cronSchedule(quartzCronEntry)).build();
  8. Date nextFireTime = cronTrigger.getFireTimeAfter(new Date(minuteStartTimeMillis-1000));
  9. if(nextFireTime.equals(new Date(minuteStartTimeMillis))) {
  10. enabledAlertIds.addAll(alertsMapByCronEntry.get(cronEntry));
  11. }
  12. }catch(Exception e) {
  13. _logger.error("Exception occured when trying to parse cron entry - " + cronEntry + " Exception - "+ ExceptionUtils.getFullStackTrace(e));
  14. }
  15. }
  16. Collections.sort(enabledAlertIds);
  17. for(BigInteger alertId : enabledAlertIds) {
  18. Alert a = alertsMapById.get(alertId);
  19. if(a!=null) {
  20. enabledAlerts.add(alertsMapById.get(alertId));
  21. }
  22. }
  23. return enabledAlerts;
  24. }

代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz

  1. /**
  2. * <p>
  3. * Called by the scheduler at the time a <code>Trigger</code> is first
  4. * added to the scheduler, in order to have the <code>Trigger</code>
  5. * compute its first fire time, based on any associated calendar.
  6. * </p>
  7. *
  8. * <p>
  9. * After this method has been called, <code>getNextFireTime()</code>
  10. * should return a valid answer.
  11. * </p>
  12. *
  13. * @return the first time at which the <code>Trigger</code> will be fired
  14. * by the scheduler, which is also the same value <code>getNextFireTime()</code>
  15. * will return (until after the first firing of the <code>Trigger</code>).
  16. * </p>
  17. */
  18. public Date computeFirstFireTime(org.quartz.Calendar calendar) {
  19. nextFireTime = getFireTimeAfter(new Date(getStartTime().getTime() - 1000l));
  20. while (nextFireTime != null && calendar != null
  21. && !calendar.isTimeIncluded(nextFireTime.getTime())) {
  22. nextFireTime = getFireTimeAfter(nextFireTime);
  23. }
  24. return nextFireTime;
  25. }

代码示例来源:origin: quartz/quartz-all

  1. Date fta = getFireTimeAfter(new Date(test.getTime().getTime() - 1000));
  2. fta = getFireTimeAfter(fta);

代码示例来源:origin: salesforce/Argus

  1. public static List<Alert> getEnabledAlertsForMinute(long minuteStartTimeMillis){
  2. List<Alert> enabledAlerts = new ArrayList<Alert>();
  3. List<BigInteger> enabledAlertIds = new ArrayList<BigInteger>();
  4. for(String cronEntry : alertsMapByCronEntry.keySet()) {
  5. try {
  6. Date minuteStartTime = new Date(minuteStartTimeMillis);
  7. String quartzCronEntry = Cron.convertToQuartzCronEntry(cronEntry);
  8. Date previousMinuteLastSecondTime = new Date(minuteStartTimeMillis - 1000);
  9. // CronTrigger getFireTimeAfter only works for current and future time. For checking from a previous point of time
  10. // we need to change startAtTime.
  11. // https://stackoverflow.com/questions/7029196/quartz-crontrigger-getting-next-fire-time
  12. CronTrigger cronTrigger = TriggerBuilder.newTrigger().withSchedule(CronScheduleBuilder.cronSchedule(quartzCronEntry)).startAt(previousMinuteLastSecondTime).build();
  13. Date nextFireTime = cronTrigger.getFireTimeAfter(previousMinuteLastSecondTime);
  14. if(nextFireTime.equals(minuteStartTime)) {
  15. enabledAlertIds.addAll(alertsMapByCronEntry.get(cronEntry));
  16. }
  17. }catch(Exception e) {
  18. _logger.error("Exception occured when trying to parse cron entry - " + cronEntry + " Exception - "+ ExceptionUtils.getFullStackTrace(e));
  19. }
  20. }
  21. Collections.sort(enabledAlertIds);
  22. for(BigInteger alertId : enabledAlertIds) {
  23. Alert a = alertsMapById.get(alertId);
  24. if(a!=null) {
  25. enabledAlerts.add(alertsMapById.get(alertId));
  26. }
  27. }
  28. return enabledAlerts;
  29. }

代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz

  1. Date fta = getFireTimeAfter(new Date(test.getTime().getTime() - 1000));
  2. fta = getFireTimeAfter(fta);

代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz

  1. Date newFireTime = getFireTimeAfter(new Date());
  2. while (newFireTime != null && cal != null
  3. && !cal.isTimeIncluded(newFireTime.getTime())) {
  4. newFireTime = getFireTimeAfter(newFireTime);

代码示例来源:origin: quartz/quartz-all

  1. Date newFireTime = getFireTimeAfter(new Date());
  2. while (newFireTime != null && cal != null
  3. && !cal.isTimeIncluded(newFireTime.getTime())) {
  4. newFireTime = getFireTimeAfter(newFireTime);

代码示例来源:origin: org.motechproject/motech-scheduler

  1. Date newStartTime = trigger.getFireTimeAfter(now.toDate());
  2. if (newStartTime == null) {
  3. newStartTime = now.toDate();

相关文章