本文整理了Java中org.quartz.CronTrigger.getFireTimeAfter()
方法的一些代码示例,展示了CronTrigger.getFireTimeAfter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CronTrigger.getFireTimeAfter()
方法的具体详情如下:
包路径:org.quartz.CronTrigger
类名称: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
/**
* <p>
* Called when the <code>{@link Scheduler}</code> has decided to 'fire'
* the trigger (execute the associated <code>Job</code>), in order to
* give the <code>Trigger</code> a chance to update itself for its next
* triggering (if any).
* </p>
*
* @see #executionComplete(JobExecutionContext, JobExecutionException)
*/
public void triggered(org.quartz.Calendar calendar) {
previousFireTime = nextFireTime;
nextFireTime = getFireTimeAfter(nextFireTime);
while (nextFireTime != null && calendar != null
&& !calendar.isTimeIncluded(nextFireTime.getTime())) {
nextFireTime = getFireTimeAfter(nextFireTime);
}
}
代码示例来源:origin: quartz/quartz-all
/**
* <p>
* Called when the <code>{@link Scheduler}</code> has decided to 'fire'
* the trigger (execute the associated <code>Job</code>), in order to
* give the <code>Trigger</code> a chance to update itself for its next
* triggering (if any).
* </p>
*
* @see #executionComplete(JobExecutionContext, JobExecutionException)
*/
public void triggered(org.quartz.Calendar calendar) {
previousFireTime = nextFireTime;
nextFireTime = getFireTimeAfter(nextFireTime);
while (nextFireTime != null && calendar != null
&& !calendar.isTimeIncluded(nextFireTime.getTime())) {
nextFireTime = getFireTimeAfter(nextFireTime);
}
}
代码示例来源:origin: stackoverflow.com
CronTrigger cal = new CronTrigger("Test", "Test", "0 0/10 * * * ?" );
...
end = start + 1000000;
...
while (current < end) {
if (i > 0) {
System.out.println(i + ":" + current);
}
Date next = cal.getFireTimeAfter(new Date(current));
current = next.getTime();
i++;
}
代码示例来源:origin: quartz/quartz-all
nextFireTime = getFireTimeAfter(previousFireTime);
while (nextFireTime != null && !calendar.isTimeIncluded(nextFireTime.getTime())) {
nextFireTime = getFireTimeAfter(nextFireTime);
long diff = now.getTime() - nextFireTime.getTime();
if(diff >= misfireThreshold) {
nextFireTime = getFireTimeAfter(nextFireTime);
continue;
代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz
nextFireTime = getFireTimeAfter(previousFireTime);
while (nextFireTime != null && !calendar.isTimeIncluded(nextFireTime.getTime())) {
nextFireTime = getFireTimeAfter(nextFireTime);
long diff = now.getTime() - nextFireTime.getTime();
if(diff >= misfireThreshold) {
nextFireTime = getFireTimeAfter(nextFireTime);
continue;
代码示例来源:origin: quartz/quartz-all
/**
* <p>
* Called by the scheduler at the time a <code>Trigger</code> is first
* added to the scheduler, in order to have the <code>Trigger</code>
* compute its first fire time, based on any associated calendar.
* </p>
*
* <p>
* After this method has been called, <code>getNextFireTime()</code>
* should return a valid answer.
* </p>
*
* @return the first time at which the <code>Trigger</code> will be fired
* by the scheduler, which is also the same value <code>getNextFireTime()</code>
* will return (until after the first firing of the <code>Trigger</code>).
* </p>
*/
public Date computeFirstFireTime(org.quartz.Calendar calendar) {
nextFireTime = getFireTimeAfter(new Date(getStartTime().getTime() - 1000l));
while (nextFireTime != null && calendar != null
&& !calendar.isTimeIncluded(nextFireTime.getTime())) {
nextFireTime = getFireTimeAfter(nextFireTime);
}
return nextFireTime;
}
代码示例来源:origin: com.salesforce.argus/argus-core
public static List<Alert> getEnabledAlertsForMinute(long minuteStartTimeMillis){
List<Alert> enabledAlerts = new ArrayList<Alert>();
List<BigInteger> enabledAlertIds = new ArrayList<BigInteger>();
for(String cronEntry : alertsMapByCronEntry.keySet()) {
try {
String quartzCronEntry = Cron.convertToQuartzCronEntry(cronEntry);
CronTrigger cronTrigger = TriggerBuilder.newTrigger().withSchedule(CronScheduleBuilder.cronSchedule(quartzCronEntry)).build();
Date nextFireTime = cronTrigger.getFireTimeAfter(new Date(minuteStartTimeMillis-1000));
if(nextFireTime.equals(new Date(minuteStartTimeMillis))) {
enabledAlertIds.addAll(alertsMapByCronEntry.get(cronEntry));
}
}catch(Exception e) {
_logger.error("Exception occured when trying to parse cron entry - " + cronEntry + " Exception - "+ ExceptionUtils.getFullStackTrace(e));
}
}
Collections.sort(enabledAlertIds);
for(BigInteger alertId : enabledAlertIds) {
Alert a = alertsMapById.get(alertId);
if(a!=null) {
enabledAlerts.add(alertsMapById.get(alertId));
}
}
return enabledAlerts;
}
代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz
/**
* <p>
* Called by the scheduler at the time a <code>Trigger</code> is first
* added to the scheduler, in order to have the <code>Trigger</code>
* compute its first fire time, based on any associated calendar.
* </p>
*
* <p>
* After this method has been called, <code>getNextFireTime()</code>
* should return a valid answer.
* </p>
*
* @return the first time at which the <code>Trigger</code> will be fired
* by the scheduler, which is also the same value <code>getNextFireTime()</code>
* will return (until after the first firing of the <code>Trigger</code>).
* </p>
*/
public Date computeFirstFireTime(org.quartz.Calendar calendar) {
nextFireTime = getFireTimeAfter(new Date(getStartTime().getTime() - 1000l));
while (nextFireTime != null && calendar != null
&& !calendar.isTimeIncluded(nextFireTime.getTime())) {
nextFireTime = getFireTimeAfter(nextFireTime);
}
return nextFireTime;
}
代码示例来源:origin: quartz/quartz-all
Date fta = getFireTimeAfter(new Date(test.getTime().getTime() - 1000));
fta = getFireTimeAfter(fta);
代码示例来源:origin: salesforce/Argus
public static List<Alert> getEnabledAlertsForMinute(long minuteStartTimeMillis){
List<Alert> enabledAlerts = new ArrayList<Alert>();
List<BigInteger> enabledAlertIds = new ArrayList<BigInteger>();
for(String cronEntry : alertsMapByCronEntry.keySet()) {
try {
Date minuteStartTime = new Date(minuteStartTimeMillis);
String quartzCronEntry = Cron.convertToQuartzCronEntry(cronEntry);
Date previousMinuteLastSecondTime = new Date(minuteStartTimeMillis - 1000);
// CronTrigger getFireTimeAfter only works for current and future time. For checking from a previous point of time
// we need to change startAtTime.
// https://stackoverflow.com/questions/7029196/quartz-crontrigger-getting-next-fire-time
CronTrigger cronTrigger = TriggerBuilder.newTrigger().withSchedule(CronScheduleBuilder.cronSchedule(quartzCronEntry)).startAt(previousMinuteLastSecondTime).build();
Date nextFireTime = cronTrigger.getFireTimeAfter(previousMinuteLastSecondTime);
if(nextFireTime.equals(minuteStartTime)) {
enabledAlertIds.addAll(alertsMapByCronEntry.get(cronEntry));
}
}catch(Exception e) {
_logger.error("Exception occured when trying to parse cron entry - " + cronEntry + " Exception - "+ ExceptionUtils.getFullStackTrace(e));
}
}
Collections.sort(enabledAlertIds);
for(BigInteger alertId : enabledAlertIds) {
Alert a = alertsMapById.get(alertId);
if(a!=null) {
enabledAlerts.add(alertsMapById.get(alertId));
}
}
return enabledAlerts;
}
代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz
Date fta = getFireTimeAfter(new Date(test.getTime().getTime() - 1000));
fta = getFireTimeAfter(fta);
代码示例来源:origin: com.opensymphony.quartz/com.springsource.org.quartz
Date newFireTime = getFireTimeAfter(new Date());
while (newFireTime != null && cal != null
&& !cal.isTimeIncluded(newFireTime.getTime())) {
newFireTime = getFireTimeAfter(newFireTime);
代码示例来源:origin: quartz/quartz-all
Date newFireTime = getFireTimeAfter(new Date());
while (newFireTime != null && cal != null
&& !cal.isTimeIncluded(newFireTime.getTime())) {
newFireTime = getFireTimeAfter(newFireTime);
代码示例来源:origin: org.motechproject/motech-scheduler
Date newStartTime = trigger.getFireTimeAfter(now.toDate());
if (newStartTime == null) {
newStartTime = now.toDate();
内容来源于网络,如有侵权,请联系作者删除!