org.quartz.Scheduler.scheduleJobs()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(378)

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

Scheduler.scheduleJobs介绍

[英]Schedule all of the given jobs with the related set of triggers.

If any of the given jobs or triggers already exist (or more specifically, if the keys are not unique) and the replace parameter is not set to true then an exception will be thrown.
[中]使用相关的触发器集安排所有给定的作业。
如果任何给定的作业或触发器已经存在(或者更具体地说,如果键不是唯一的),并且replace参数未设置为true,则将引发异常。

代码示例

代码示例来源:origin: myschedule/myschedule-quartz-extra

public void scheduleJobs(Map<JobDetail, Set<? extends Trigger>> triggersAndJobs, boolean replace) {
  try {
    scheduler.scheduleJobs(triggersAndJobs, replace);
  } catch (SchedulerException e) {
    throw new QuartzRuntimeException(e);
  }
}

代码示例来源:origin: org.codelibs/elasticsearch-quartz

public void scheduleJobs(
    final Map<JobDetail, Set<? extends Trigger>> triggersAndJobs,
    final boolean replace) {
  try {
    scheduler.scheduleJobs(triggersAndJobs, replace);
  } catch (final SchedulerException e) {
    throw new QuartzSchedulerException(e);
  }
}

代码示例来源:origin: OpenWiseSolutions/openhub-framework

@Override
public void scheduleJobs(Map<JobDetail, Set<? extends Trigger>> triggersAndJobs, boolean replace) throws SchedulerException {
  getScheduler().scheduleJobs(triggersAndJobs, replace);
}

代码示例来源:origin: com.threewks.thundr/thundr-quartz

@Override
public void scheduleJobs(Map<JobDetail, List<Trigger>> triggersAndJobs, boolean replace) throws QuartzException {
  try {
    delegate.scheduleJobs(triggersAndJobs, replace);
  } catch (SchedulerException e) {
    Logger.error(e.getMessage());
    throw new QuartzException(e);
  }
}

代码示例来源:origin: com.threewks.thundr/thundr-contrib-quartz

@Override
public void scheduleJobs(Map<JobDetail, List<Trigger>> triggersAndJobs, boolean replace) throws QuartzException {
  try {
    delegate.scheduleJobs(triggersAndJobs, replace);
  } catch (SchedulerException e) {
    Logger.error(e.getMessage());
    throw new QuartzException(e);
  }
}

代码示例来源:origin: cdapio/cdap

@Test
public void testStoreJobsAndTriggers() throws SchedulerException {
 schedulerSetup(true);
 Map<JobDetail, Set<? extends Trigger>> multiJobsTriggers = new HashMap<>();
 JobDetail job1 = getJobDetail("mapreduce1");
 multiJobsTriggers.put(job1, Sets.newHashSet(getTrigger("p1"), getTrigger("p2")));
 JobDetail job2 = getJobDetail("mapreduce2");
 multiJobsTriggers.put(job2, Sets.newHashSet(getTrigger("p3")));
 scheduler.scheduleJobs(multiJobsTriggers, true);
 verifyJobAndTriggers(job1.getKey(), 2, Trigger.TriggerState.NORMAL);
 verifyJobAndTriggers(job2.getKey(), 1, Trigger.TriggerState.NORMAL);
 // verify across restart that the jobs and triggers gets retrieved from the store
 //Shutdown scheduler.
 schedulerTearDown();
 //restart scheduler.
 schedulerSetup(true);
 verifyJobAndTriggers(job1.getKey(), 2, Trigger.TriggerState.NORMAL);
 verifyJobAndTriggers(job2.getKey(), 1, Trigger.TriggerState.NORMAL);
 schedulerTearDown();
}

相关文章