Java源码示例:org.quartz.simpl.SimpleJobFactory

示例1
protected Scheduler createScheduler(String name, int threadPoolSize) throws SchedulerException {
  try {
    this.taskSchedulerHelper = new TaskSchedulerHelper(database.getInstance());
    this.taskSchedulerHelper.init(threadPoolSize, new SimpleJobFactory());
    this.taskSchedulerHelper.start();
    return ((QuartzSchedulerSPI) taskSchedulerHelper.getScheduler()).getScheduler();
  }
  catch (Exception e) {
    Throwables.throwIfUnchecked(e);
    throw new RuntimeException(e);
  }
}
 
示例2
@Bean
public SchedulerFactoryBean schedulerFactoryBean() {
    SchedulerFactoryBean scheduler = new SchedulerFactoryBean();
    scheduler.setTaskExecutor(getAsyncExecutor());
    scheduler.setAutoStartup(true);
    scheduler.setJobFactory(new SimpleJobFactory());
    return scheduler;
}