本文整理了Java中org.quartz.Trigger.getTriggerBuilder()
方法的一些代码示例,展示了Trigger.getTriggerBuilder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Trigger.getTriggerBuilder()
方法的具体详情如下:
包路径:org.quartz.Trigger
类名称:Trigger
方法名:getTriggerBuilder
[英]Get a TriggerBuilder that is configured to produce a Trigger
identical to this one.
[中]获取一个TriggerBuilder,它被配置为生成与此相同的Trigger
。
代码示例来源:origin: bill1012/AdminEAP
/**
* 调度单个任务 SimpleTrigger 和 CronTrigger
*/
public void scheduleSingleJob(ScheduleJob job) throws SchedulerException, ClassNotFoundException {
Scheduler scheduler = schedulerFactoryBean.getScheduler();
// List<ScheduleJob> jobList = getAllJobs();
TriggerKey triggerKey = TriggerKey.triggerKey(job.getTriggerName(), job.getTriggerGroup());
// 获取trigger
Trigger trigger = scheduler.getTrigger(triggerKey);
// 不存在,创建一个
// if (null == trigger) {
if (!scheduler.checkExists(triggerKey)) {
JobDetail jobDetail = JobBuilder.newJob((Class<? extends Job>) Class.forName(job.getJobClass()))
.withIdentity(job.getJobName(), job.getJobGroup()).withDescription(job.getDesc()).build();
TriggerBuilder triggerBuilder = TriggerBuilder.newTrigger();
trigger = setTriggerParam(job, triggerKey, triggerBuilder, trigger);
scheduler.scheduleJob(jobDetail, trigger);
} else {
// trigger已经存在,更新相应的定时设置
TriggerBuilder triggerBuilder = trigger.getTriggerBuilder();
trigger = setTriggerParam(job, triggerKey, triggerBuilder, trigger);
// 按新的trigger重新设置job执行
scheduler.rescheduleJob(triggerKey, trigger);
}
}
代码示例来源:origin: stackoverflow.com
// retrieve the trigger
Trigger oldTrigger = sched.getTrigger(triggerKey("oldTrigger", "group1");
// obtain a builder that would produce the trigger
TriggerBuilder tb = oldTrigger.getTriggerBuilder();
// update the schedule associated with the builder, and build the new trigger
// (other builder methods could be called, to change the trigger in any desired way)
Trigger newTrigger = tb.withSchedule(simpleSchedule()
.withIntervalInSeconds(10)
.withRepeatCount(10)
.build();
sched.rescheduleJob(oldTrigger.getKey(), newTrigger);
代码示例来源:origin: stackoverflow.com
// retrieve the trigger
Trigger oldTrigger = sched.getTrigger(triggerKey("oldTrigger", "group1");
// obtain a builder that would produce the trigger
TriggerBuilder tb = oldTrigger.getTriggerBuilder();
// update the schedule associated with the builder, and build the new trigger
// (other builder methods could be called, to change the trigger in any desired way)
Trigger newTrigger = tb.withSchedule(simpleSchedule()
.withIntervalInSeconds(10)
.withRepeatCount(10)
.build();
//Reschedule
sched.rescheduleJob(oldTrigger.getKey(), newTrigger);
代码示例来源:origin: org.exoplatform.kernel/exo.kernel.component.common
public Date rescheduleJob(String jobName, String groupName, Trigger newTrigger) throws SchedulerException
{
return scheduler_.rescheduleJob(TriggerKey.triggerKey(jobName, getGroupName(groupName)), newTrigger
.getTriggerBuilder().withIdentity(jobName, getGroupName(groupName)).build());
}
代码示例来源:origin: bingoohuang/quartz-glass
@RequestMapping("/restartTrigger")
public String restartTrigger(String group, String name) throws SchedulerException {
Trigger trigger = quartzScheduler.getTrigger(new TriggerKey(name, group));
if (trigger == null) return "redirect:/glass/";
trigger = trigger.getTriggerBuilder().startAt(new Date()).build();
quartzScheduler.rescheduleJob(trigger.getKey(), trigger);
return "redirect:/glass/";
}
代码示例来源:origin: org.exoplatform.kernel/exo.kernel.component.common
public void addJob(JobInfo jinfo, Trigger trigger) throws Exception
{
JobInfo jobinfo = getJobInfo(jinfo);
trigger = trigger.getTriggerBuilder().withIdentity(jobinfo.getJobName(), jobinfo.getGroupName()).build();
@SuppressWarnings("unchecked")
JobDetail job =
JobBuilder.newJob(jobinfo.getJob()).withIdentity(jobinfo.getJobName(), jobinfo.getGroupName()).build();
scheduleJob(job, trigger);
}
代码示例来源:origin: org.exoplatform.kernel/exo.kernel.component.common
public void addJob(JobDetail job, Trigger trigger) throws Exception
{
String gname = getGroupName(job.getKey().getGroup());
trigger = trigger.getTriggerBuilder().withIdentity(job.getKey().getName(), gname).build();
scheduleJob(job.getJobBuilder().withIdentity(job.getKey().getName(), gname).build(), trigger);
}
代码示例来源:origin: bonitasoft/bonita-engine
@Override
public Date rescheduleJob(final String triggerName, final String groupName, final Date triggerStartTime) throws SSchedulerException {
final TriggerKey triggerKey = new TriggerKey(triggerName, groupName);
try {
final org.quartz.Trigger oldTrigger = scheduler.getTrigger(triggerKey);
final org.quartz.Trigger newTrigger = oldTrigger.getTriggerBuilder().startAt(triggerStartTime).build();
return scheduler.rescheduleJob(triggerKey, newTrigger);
} catch (final SchedulerException e) {
throw new SSchedulerException("Can't get the trigger " + triggerKey, e);
}
}
代码示例来源:origin: bonitasoft/bonita-engine
@Override
public Date rescheduleJob(final String triggerName, final String groupName, final Date triggerStartTime) throws SSchedulerException {
final TriggerKey triggerKey = new TriggerKey(triggerName, groupName);
try {
final org.quartz.Trigger oldTrigger = scheduler.getTrigger(triggerKey);
final org.quartz.Trigger newTrigger = oldTrigger.getTriggerBuilder().startAt(triggerStartTime).build();
return scheduler.rescheduleJob(triggerKey, newTrigger);
} catch (final SchedulerException e) {
throw new SSchedulerException("Can't get the trigger " + triggerKey, e);
}
}
代码示例来源:origin: dqeasycloud/easy-cloud
private Trigger buildCalendar(final EcTaskSchedulerDTO taskSchedulerDTO, final Trigger trigger) throws SchedulerException {
logger.info("holidayName:" + taskSchedulerDTO.getHolidayName());
logger.info("holidays:" + taskSchedulerDTO.getHolidayDTOs());
if (taskSchedulerDTO.getHolidayName() != null && EcCollectionsUtils.isNotEmpty(taskSchedulerDTO.getHolidayDTOs())) {
AnnualCalendar holidays = new AnnualCalendar();
for (EcHolidayDTO holidayDTO : taskSchedulerDTO.getHolidayDTOs()) {
Calendar calendar = new GregorianCalendar(holidayDTO.getYear(), holidayDTO.getMonth() - 1, holidayDTO.getDay());
holidays.setDayExcluded(calendar, true);
}
scheduler.addCalendar(taskSchedulerDTO.getHolidayName(), holidays, true, true);
return trigger.getTriggerBuilder().modifiedByCalendar(taskSchedulerDTO.getHolidayName()).build();
} else {
return trigger.getTriggerBuilder().modifiedByCalendar(null).build();
}
// return trigger;
}
代码示例来源:origin: stackoverflow.com
logger.info("Rescheduling the Job");
Trigger oldTrigger = scheduler.getTrigger(new TriggerKey(jobData.getJobName()+"Trigger"));
TriggerBuilder tb = oldTrigger.getTriggerBuilder();
Trigger newTrigger = tb.withSchedule(simpleSchedule()
.withIntervalInMilliseconds(jobData.getRepeatInterval()).
代码示例来源:origin: dqeasycloud/easy-cloud
trigger = buildCalendar(taskSchedulerDTO, trigger);
if (jobDetail != null) {
trigger = trigger.getTriggerBuilder().forJob(jobDetail).build();
scheduler.scheduleJob(trigger);
} else {
代码示例来源:origin: cdapio/cdap
public void resumeProgramSchedule(ProgramSchedule schedule) throws NotFoundException, SchedulerException {
try {
Collection<TriggerKey> triggerKeys = getGroupedTriggerKeys(schedule);
// Must assert all trigger keys exist before processing each trigger key
assertTriggerKeysExist(triggerKeys);
for (TriggerKey triggerKey : triggerKeys) {
if (triggerKey.getGroup().equals(PAUSED_NEW_TRIGGERS_GROUP)) {
Trigger neverScheduledTrigger = scheduler.getTrigger(triggerKey);
TriggerBuilder<? extends Trigger> triggerBuilder = neverScheduledTrigger.getTriggerBuilder();
// move this key from TimeScheduler#PAUSED_NEW_TRIGGERS_GROUP to the Key#DEFAULT_GROUP group
// (when no group name is provided default is used)
Trigger resumedTrigger = triggerBuilder.withIdentity(triggerKey.getName()).build();
scheduler.rescheduleJob(neverScheduledTrigger.getKey(), resumedTrigger);
triggerKey = resumedTrigger.getKey();
}
scheduler.resumeTrigger(triggerKey);
}
} catch (org.quartz.SchedulerException e) {
throw new SchedulerException(e);
}
}
代码示例来源:origin: co.cask.cdap/cdap-app-fabric
public void resumeProgramSchedule(ProgramSchedule schedule) throws NotFoundException, SchedulerException {
try {
Collection<TriggerKey> triggerKeys = getGroupedTriggerKeys(schedule);
// Must assert all trigger keys exist before processing each trigger key
assertTriggerKeysExist(triggerKeys);
for (TriggerKey triggerKey : triggerKeys) {
if (triggerKey.getGroup().equals(PAUSED_NEW_TRIGGERS_GROUP)) {
Trigger neverScheduledTrigger = scheduler.getTrigger(triggerKey);
TriggerBuilder<? extends Trigger> triggerBuilder = neverScheduledTrigger.getTriggerBuilder();
// move this key from TimeScheduler#PAUSED_NEW_TRIGGERS_GROUP to the Key#DEFAULT_GROUP group
// (when no group name is provided default is used)
Trigger resumedTrigger = triggerBuilder.withIdentity(triggerKey.getName()).build();
scheduler.rescheduleJob(neverScheduledTrigger.getKey(), resumedTrigger);
triggerKey = resumedTrigger.getKey();
}
scheduler.resumeTrigger(triggerKey);
}
} catch (org.quartz.SchedulerException e) {
throw new SchedulerException(e);
}
}
代码示例来源:origin: org.ikasan/ikasan-quartz-endpoint
TriggerBuilder oldTriggerBuilder = oldTrigger.getTriggerBuilder();
Trigger newTrigger = oldTriggerBuilder.usingJobData(EAGER_CALLBACK_COUNT, eagerCallback).
startNow().
代码示例来源:origin: org.ikasan/ikasan-quartz-endpoint
Trigger newTrigger = getBusinessTrigger(oldTrigger.getTriggerBuilder());
newTrigger.getJobDataMap().clear();
内容来源于网络,如有侵权,请联系作者删除!