Example usage for org.springframework.scheduling.quartz SchedulerFactoryBean start

List of usage examples for org.springframework.scheduling.quartz SchedulerFactoryBean start

Introduction

In this page you can find the example usage for org.springframework.scheduling.quartz SchedulerFactoryBean start.

Prototype

@Override
    public void start() throws SchedulingException 

Source Link

Usage

From source file:mg.jerytodik.scheduler.listeners.JerytodikInitializerListener.java

@SuppressWarnings("resource")
@Override/*from w  w  w  . j  a  v  a  2 s  .  co  m*/
public void contextInitialized(final ServletContextEvent contextEvent) {
    super.contextInitialized(contextEvent);

    final ApplicationContext applicationContext = new AnnotationConfigApplicationContext(
            JeryTodikSchedulerConfig.class);

    final SchedulerFactoryBean schedulerFactoryBean = applicationContext.getBean(SchedulerFactoryBean.class);

    try {
        schedulerFactoryBean.start();
    } catch (Exception e) {
        LOGGER.error("Error occured.", e);
    }
}

From source file:org.apache.fineract.infrastructure.jobs.service.JobRegisterServiceImpl.java

private Scheduler createScheduler(final String name, final int noOfThreads, JobListener... jobListeners)
        throws Exception {
    final SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
    schedulerFactoryBean.setSchedulerName(name);
    schedulerFactoryBean.setGlobalJobListeners(jobListeners);
    final TriggerListener[] globalTriggerListeners = { globalSchedulerTriggerListener };
    schedulerFactoryBean.setGlobalTriggerListeners(globalTriggerListeners);
    final Properties quartzProperties = new Properties();
    quartzProperties.put(SchedulerFactoryBean.PROP_THREAD_COUNT, Integer.toString(noOfThreads));
    schedulerFactoryBean.setQuartzProperties(quartzProperties);
    schedulerFactoryBean.afterPropertiesSet();
    schedulerFactoryBean.start();
    return schedulerFactoryBean.getScheduler();
}