Java Code Examples for org.quartz.simpl.RAMJobStore

The following examples show how to use org.quartz.simpl.RAMJobStore. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: dropwizard-experiment   Source File: Quartz.java    License: MIT License 6 votes vote down vote up
private Properties getProperties() {
    Properties props = new Properties();

    props.setProperty("org.quartz.jobStore.class", quartzConfig.getJobStore().getName());
    props.setProperty("org.quartz.threadPool.threadCount", String.valueOf(quartzConfig.getThreads()));

    if (!quartzConfig.getJobStore().equals(RAMJobStore.class)) {
        props.setProperty("org.quartz.jobStore.driverDelegateClass", quartzConfig.getDbDelegate().getName());
        props.setProperty("org.quartz.jobStore.dataSource", "main");
        props.setProperty("org.quartz.dataSource.main.driver", dbConfig.getDriverClass());
        props.setProperty("org.quartz.dataSource.main.URL", dbConfig.getUrl());
        props.setProperty("org.quartz.dataSource.main.user", dbConfig.getUser());
        props.setProperty("org.quartz.dataSource.main.password", dbConfig.getPassword());
    }

    return props;
}
 
Example 2
Source Project: quartz-glass   Source File: SpringConfig.java    License: Apache License 2.0 6 votes vote down vote up
@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.scheduler.skipUpdateCheck","true");
    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 {
        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;
}
 
Example 3
Source Project: AsuraFramework   Source File: DirectSchedulerFactory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates an in memory job store (<code>{@link RAMJobStore}</code>)
 * The thread priority is set to Thread.NORM_PRIORITY
 *
 * @param maxThreads
 *          The number of threads in the thread pool
 * @throws SchedulerException
 *           if initialization failed.
 */
public void createVolatileScheduler(int maxThreads)
    throws SchedulerException {
    SimpleThreadPool threadPool = new SimpleThreadPool(maxThreads,
            Thread.NORM_PRIORITY);
    threadPool.initialize();
    JobStore jobStore = new RAMJobStore();
    this.createScheduler(threadPool, jobStore);

}
 
Example 4
Source Project: lams   Source File: DirectSchedulerFactory.java    License: GNU General Public License v2.0 3 votes vote down vote up
/**
 * Creates an in memory job store (<code>{@link RAMJobStore}</code>)
 * The thread priority is set to Thread.NORM_PRIORITY
 *
 * @param maxThreads
 *          The number of threads in the thread pool
 * @throws SchedulerException
 *           if initialization failed.
 */
public void createVolatileScheduler(int maxThreads)
    throws SchedulerException {
    SimpleThreadPool threadPool = new SimpleThreadPool(maxThreads,
            Thread.NORM_PRIORITY);
    threadPool.initialize();
    JobStore jobStore = new RAMJobStore();
    this.createScheduler(threadPool, jobStore);
}