List of usage examples for org.springframework.scheduling.quartz SchedulerFactoryBean getObject
@Override
@Nullable
public Scheduler getObject()
From source file:com.wiiyaya.provider.main.service.impl.BatchServiceImpl.java
@Autowired public BatchServiceImpl(SchedulerFactoryBean schedulerFactoryBean) { scheduler = schedulerFactoryBean.getObject(); }
From source file:com.github.dbourdette.glass.SpringConfig.java
@Bean public Scheduler quartzScheduler(ApplicationContext context) throws Exception { SchedulerFactoryBean factory = new SchedulerFactoryBean(); factory.setApplicationContext(context); factory.setExposeSchedulerInRepository(true); factory.setApplicationContextSchedulerContextKey(APPLICATION_CONTEXT_KEY); factory.setJobFactory(glassJobFactory); Properties properties = new Properties(); properties.setProperty("org.quartz.threadPool.class", SimpleThreadPool.class.getName()); properties.setProperty("org.quartz.threadPool.threadCount", "15"); properties.setProperty("org.quartz.threadPool.threadPriority", "4"); if (configuration().isInMemory()) { properties.setProperty("org.quartz.jobStore.class", RAMJobStore.class.getName()); } else {//w ww .jav a2 s.co m factory.setDataSource(dataSource()); properties.setProperty("org.quartz.jobStore.tablePrefix", configuration().getTablePrefix()); properties.setProperty("org.quartz.jobStore.isClustered", "false"); properties.setProperty("org.quartz.jobStore.driverDelegateClass", configuration().getDriverDelegateClass()); } factory.setQuartzProperties(properties); factory.afterPropertiesSet(); Scheduler scheduler = factory.getObject(); scheduler.getListenerManager().addJobListener(glassJobListener); scheduler.getListenerManager().addSchedulerListener(glassSchedulerListener); scheduler.start(); return scheduler; }