本文整理汇总了Java中org.quartz.impl.triggers.AbstractTrigger类的典型用法代码示例。如果您正苦于以下问题:Java AbstractTrigger类的具体用法?Java AbstractTrigger怎么用?Java AbstractTrigger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractTrigger类属于org.quartz.impl.triggers包,在下文中一共展示了AbstractTrigger类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createTrigger
import org.quartz.impl.triggers.AbstractTrigger; //导入依赖的package包/类
/** Creates a SimpleTrigger with an interval computed from the hours, minutes and seconds.
*/
private static AbstractTrigger<?> createTrigger(ScheduledTask task, Recurrence.Often recurrence) throws FrameworkException, ApplicationExceptions {
// Compute the repeatInterval for the SimpleTrigger in milliseconds
long repeatInterval = 0;
if (recurrence.getHours() != null)
repeatInterval += recurrence.getHours() * 60 * 60 * 1000;
if (recurrence.getMinutes() != null)
repeatInterval += recurrence.getMinutes() * 60 * 1000;
if (recurrence.getSeconds() != null)
repeatInterval += recurrence.getSeconds() * 1000;
SimpleTriggerImpl trigger = new SimpleTriggerImpl();
if (repeatInterval > 0) {
trigger.setRepeatInterval(repeatInterval);
trigger.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY);
}
return trigger;
}
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:20,代码来源:TriggerHelper.java
示例2: addReminderJob
import org.quartz.impl.triggers.AbstractTrigger; //导入依赖的package包/类
public void addReminderJob(TaskReminder reminder,ProcessInstance processInstance,Task task) {
try {
AbstractTrigger<? extends Trigger> trigger=null;
if(reminder.getType().equals(ReminderType.Once)){
SimpleTriggerImpl simpleTrigger=new SimpleTriggerImpl();
simpleTrigger.setRepeatCount(0);
trigger=simpleTrigger;
long executeTime=reminder.getStartDate().getTime()+10000;
long now=(new Date()).getTime();
if(executeTime<=now){
return;
}
}else{
CronTriggerImpl cronTrigger=new CronTriggerImpl();
cronTrigger.setCronExpression(reminder.getCron());
trigger=cronTrigger;
}
trigger.setName("trigger_"+reminder.getId());
trigger.setStartTime(reminder.getStartDate());
ReminderJobDetail jobDetail=new ReminderJobDetail();
jobDetail.setJobClass(ReminderJob.class);
ReminderHandler handler=(ReminderHandler)applicationContext.getBean(reminder.getReminderHandlerBean());
jobDetail.setReminderHandlerBean(handler);
if(task==null){
task=taskService.getTask(reminder.getTaskId());
}
jobDetail.setTask(task);
jobDetail.setProcessInstance(processService.getProcessInstanceById(task.getProcessInstanceId()));
jobDetail.setKey(new JobKey(JOB_NAME_PREFIX+reminder.getId(),JOB_GROUP_PREFIX));
Calendar calendar=getCalendar(reminder,processInstance,task);
if(calendar!=null){
String calendarName=REMINDER_CALENDAR_PREFIX+reminder.getId();
scheduler.addCalendar(calendarName, calendar,false, false);
trigger.setCalendarName(calendarName);
}
scheduler.scheduleJob(jobDetail, trigger);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:youseries,项目名称:uflo,代码行数:41,代码来源:SchedulerServiceImpl.java
示例3: done
import org.quartz.impl.triggers.AbstractTrigger; //导入依赖的package包/类
public void done(StatusEnum status) {
if (status != StatusEnum.UNKNOWN) {
objectParameters.put(KEY_JOB_STATUS, status.name());
}
Date endDate = new Date();
jobDetail.setEndTime(endDate);
if (log.isDebugEnabled()) {
log.debug("Job complete: " + jobId.toString());
}
//stop the firing
if (trigger instanceof AbstractTrigger) {
AbstractTrigger abstractTrigger = (AbstractTrigger) trigger;
abstractTrigger.setEndTime(endDate);
abstractTrigger.setNextFireTime(null);
} else {
if (log.isErrorEnabled()) {
log.error("Unexpected trigger type, not AbstractTrigger.");
}
}
try {
scheduler.unscheduleJob(jobId);
} catch (WinderException e) {
log.error("Failure unscheduling job: " + jobId.toString(), e);
}
}
开发者ID:eBay,项目名称:Winder,代码行数:28,代码来源:QuartzJobContext.java
注:本文中的org.quartz.impl.triggers.AbstractTrigger类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论