/** * Create a quartz scheduler. Quartz factory method is not used, because inflexible in allowing * custom jobstore and turning off check for new versions. * * @param store JobStore. * @param cConf CConfiguration. * @return an instance of {@link org.quartz.Scheduler} * @throws SchedulerException */ private org.quartz.Scheduler getScheduler(JobStore store, CConfiguration cConf) throws SchedulerException { int threadPoolSize = cConf.getInt( Constants.Scheduler.CFG_SCHEDULER_MAX_THREAD_POOL_SIZE, Constants.Scheduler.DEFAULT_THREAD_POOL_SIZE); ExecutorThreadPool threadPool = new ExecutorThreadPool(threadPoolSize); threadPool.initialize(); String schedulerName = DirectSchedulerFactory.DEFAULT_SCHEDULER_NAME; String schedulerInstanceId = DirectSchedulerFactory.DEFAULT_INSTANCE_ID; QuartzSchedulerResources qrs = new QuartzSchedulerResources(); JobRunShellFactory jrsf = new StdJobRunShellFactory(); qrs.setName(schedulerName); qrs.setInstanceId(schedulerInstanceId); qrs.setJobRunShellFactory(jrsf); qrs.setThreadPool(threadPool); qrs.setThreadExecutor(new DefaultThreadExecutor()); qrs.setJobStore(store); qrs.setRunUpdateCheck(false); QuartzScheduler qs = new QuartzScheduler(qrs, -1, -1); ClassLoadHelper cch = new CascadingClassLoadHelper(); cch.initialize(); store.initialize(cch, qs.getSchedulerSignaler()); org.quartz.Scheduler scheduler = new StdScheduler(qs); jrsf.initialize(scheduler); qs.initialize(); return scheduler; }