use of org.quartz.Trigger in project cdap by caskdata.
the class DatasetBasedTimeScheduleStoreTest method testStoreJobsAndTriggers.
@Test
public void testStoreJobsAndTriggers() throws SchedulerException {
schedulerSetup(true);
Map<JobDetail, Set<? extends Trigger>> multiJobsTriggers = new HashMap<>();
JobDetail job1 = getJobDetail("mapreduce1");
multiJobsTriggers.put(job1, Sets.newHashSet(getTrigger("p1"), getTrigger("p2")));
JobDetail job2 = getJobDetail("mapreduce2");
multiJobsTriggers.put(job2, Sets.newHashSet(getTrigger("p3")));
scheduler.scheduleJobs(multiJobsTriggers, true);
verifyJobAndTriggers(job1.getKey(), 2, Trigger.TriggerState.NORMAL);
verifyJobAndTriggers(job2.getKey(), 1, Trigger.TriggerState.NORMAL);
// verify across restart that the jobs and triggers gets retrieved from the store
//Shutdown scheduler.
schedulerTearDown();
//restart scheduler.
schedulerSetup(true);
verifyJobAndTriggers(job1.getKey(), 2, Trigger.TriggerState.NORMAL);
verifyJobAndTriggers(job2.getKey(), 1, Trigger.TriggerState.NORMAL);
schedulerTearDown();
}
use of org.quartz.Trigger in project simba-os by cegeka.
the class JobSchedulerConfiguration method schedulerFactory.
@Bean(destroyMethod = "destroy")
public SchedulerFactoryBean schedulerFactory() {
Properties quartzProperties = new Properties();
quartzProperties.put("org.quartz.threadPool.threadCount", "2");
quartzProperties.put("org.quartz.jobStore.driverDelegateClass", quartzJobstoreDelegate);
Trigger[] triggers = new Trigger[] { verifyAuditLogIntegrityTrigger, cleanUpAuditLogTrigger, purgeExpiredLoginMappingsTrigger, purgeExpiredSessionsTrigger, markUsersForPasswordChangeTrigger };
SchedulerFactoryBean bean = new SchedulerFactoryBean();
bean.setDataSource(dataSource);
bean.setWaitForJobsToCompleteOnShutdown(false);
bean.setApplicationContextSchedulerContextKey("applicationContext");
bean.setQuartzProperties(quartzProperties);
bean.setTriggers(triggers);
return bean;
}
use of org.quartz.Trigger in project ddf by codice.
the class ScheduledCommandTask method updateTask.
@Override
public void updateTask(Map<String, Object> properties) {
if (MapUtils.isEmpty(properties)) {
LOGGER.info("Empty or null properties map. No action taken.");
return;
}
Object commandValue = properties.get(CommandJob.COMMAND_KEY);
if (commandValue != null) {
this.command = commandValue.toString();
}
Object intervalString = properties.get(INTERVAL_STRING);
if (intervalString != null) {
LOGGER.debug("Updating intervalString : {}", intervalString);
this.intervalString = (String) intervalString;
}
Object intervalType = properties.get(INTERVAL_TYPE);
if (intervalType != null) {
LOGGER.debug("Updating intervalType : {}", intervalType);
this.intervalType = (String) intervalType;
}
JobDetail newJob = createJob();
Trigger newTrigger = createTrigger();
if (newTrigger == null) {
return;
}
try {
scheduler.addJob(newJob, true);
scheduler.rescheduleJob(triggerKey, newTrigger);
} catch (SchedulerException e) {
LOGGER.info("Error with rescheduling of task.", e);
}
}
Aggregations