use of org.quartz.impl.StdSchedulerFactory in project ovirt-engine by oVirt.
the class SchedulerUtilQuartzImpl method setup.
/*
* retrieving the quartz scheduler from the factory.
*/
public void setup() {
try {
SchedulerFactory sf = new StdSchedulerFactory();
sched = sf.getScheduler();
sched.start();
sched.getListenerManager().addJobListener(new FixedDelayJobListener(this), jobGroupEquals(Scheduler.DEFAULT_GROUP));
} catch (SchedulerException se) {
log.error("there is a problem with the underlying Scheduler: {}", se.getMessage());
log.debug("Exception", se);
}
}
use of org.quartz.impl.StdSchedulerFactory in project sharding-jdbc by shardingjdbc.
the class BASETransactionJobFactory method start.
/**
* start job.
*
* @throws SchedulerException quartz scheduler exception
*/
public void start() throws SchedulerException {
SchedulerFactory schedulerFactory = new StdSchedulerFactory();
Scheduler scheduler = schedulerFactory.getScheduler();
scheduler.scheduleJob(buildJobDetail(), buildTrigger());
scheduler.start();
}
use of org.quartz.impl.StdSchedulerFactory in project sponge by softelnet.
the class QuartzEventScheduler method doStartup.
/**
* Starts up this event scheduler.
*/
@Override
public void doStartup() {
try {
Properties props = new Properties();
props.put(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, getName());
props.put(StdSchedulerFactory.PROP_SCHED_INSTANCE_ID, getName());
props.put(StdSchedulerFactory.PROP_THREAD_POOL_CLASS, SimpleThreadPool.class.getName());
// There should be only one thread here to ensure the proper order of scheduled events.
props.put(PROP_THREAD_COUNT, Integer.toString(1));
StdSchedulerFactory schedulerFactory = new StdSchedulerFactory();
schedulerFactory.initialize(props);
scheduler = schedulerFactory.getScheduler();
scheduler.start();
} catch (SchedulerException e) {
throw SpongeUtils.wrapException(getName(), e);
}
}
use of org.quartz.impl.StdSchedulerFactory in project midpoint by Evolveum.
the class QuartzInitializationHelper method initializeScheduler.
/**
* Prepares Quartz scheduler. Configures its properties (based on Task Manager configuration) and creates the instance.
* Does not start the scheduler, because this is done during post initialization.
*/
public void initializeScheduler() throws TaskManagerInitializationException {
Properties quartzProperties = new Properties();
if (configuration.isJdbcJobStore()) {
quartzProperties.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
quartzProperties.put("org.quartz.jobStore.driverDelegateClass", configuration.getJdbcDriverDelegateClass());
quartzProperties.put("org.quartz.jobStore.clusterCheckinInterval", String.valueOf(configuration.getQuartzClusterCheckinInterval()));
quartzProperties.put("org.quartz.jobStore.clusterCheckinGracePeriod", String.valueOf(configuration.getQuartzClusterCheckinGracePeriod()));
createQuartzDbSchema(configuration);
final String myDs = "myDS";
quartzProperties.put("org.quartz.jobStore.dataSource", myDs);
if (configuration.isUseRepositoryConnectionProvider()) {
int index = (int) (Math.random() * Integer.MAX_VALUE);
RepositoryConnectionProvider.DATA_SOURCES.put(index, repositoryDataSource);
quartzProperties.put("org.quartz.dataSource." + myDs + ".connectionProvider.class", RepositoryConnectionProvider.class.getName());
quartzProperties.put("org.quartz.dataSource." + myDs + ".dataSourceIndex", String.valueOf(index));
} else if (configuration.getDataSource() != null) {
quartzProperties.put("org.quartz.dataSource." + myDs + ".jndiURL", configuration.getDataSource());
} else {
quartzProperties.put("org.quartz.dataSource." + myDs + ".provider", "hikaricp");
quartzProperties.put("org.quartz.dataSource." + myDs + ".driver", configuration.getJdbcDriver());
quartzProperties.put("org.quartz.dataSource." + myDs + ".URL", configuration.getJdbcUrl());
quartzProperties.put("org.quartz.dataSource." + myDs + ".user", configuration.getJdbcUser());
quartzProperties.put("org.quartz.dataSource." + myDs + ".password", configuration.getJdbcPassword());
}
quartzProperties.put("org.quartz.jobStore.isClustered", configuration.isClustered() ? "true" : "false");
} else {
quartzProperties.put("org.quartz.jobStore.class", "org.quartz.simpl.RAMJobStore");
}
quartzProperties.put("org.quartz.scheduler.instanceName", "midPointScheduler");
quartzProperties.put("org.quartz.scheduler.instanceId", configuration.getNodeId());
quartzProperties.put("org.quartz.scheduler.skipUpdateCheck", "true");
quartzProperties.put("org.quartz.threadPool.threadCount", Integer.toString(configuration.getThreads()));
quartzProperties.put("org.quartz.scheduler.idleWaitTime", Integer.toString(determineIdleWaitTime()));
quartzProperties.put("org.quartz.scheduler.jmx.export", "true");
if (configuration.isTestMode()) {
LOGGER.info("QuartzScheduler is set to be reusable: the task manager threads will NOT be stopped on shutdown. Also, scheduler threads will run as daemon ones.");
quartzProperties.put("org.quartz.scheduler.makeSchedulerThreadDaemon", "true");
quartzProperties.put("org.quartz.threadPool.makeThreadsDaemons", "true");
}
LOGGER.info("Initializing Quartz scheduler (but not starting it yet).");
// initialize the scheduler (without starting it)
try {
LOGGER.trace("Quartz scheduler properties: {}", quartzProperties);
StdSchedulerFactory sf = new StdSchedulerFactory();
sf.initialize(quartzProperties);
Scheduler scheduler = sf.getScheduler();
setMySchedulerListener(scheduler);
localScheduler.setQuartzScheduler(scheduler);
LOGGER.info("... Quartz scheduler initialized.");
} catch (SchedulerException e) {
throw new TaskManagerInitializationException("Cannot initialize the Quartz scheduler", e);
}
}
use of org.quartz.impl.StdSchedulerFactory in project serverless by bluenimble.
the class SchedulerPlugin method init.
@Override
public void init(final ApiServer server) throws Exception {
this.server = server;
Properties props = new Properties();
Iterator<String> keys = scheduler.keys();
while (keys.hasNext()) {
String key = keys.next();
props.put(key, scheduler.get(key));
}
StdSchedulerFactory factory = new StdSchedulerFactory();
factory.initialize(props);
oScheduler = factory.getScheduler();
oScheduler.start();
}
Aggregations