public JobBuilder getJobBuilder() { JobBuilder b = JobBuilder.newJob() .ofType(getJobClass()) .requestRecovery(requestsRecovery()) .storeDurably(isDurable()) .usingJobData(getJobDataMap()) .withDescription(getDescription()) .withIdentity(getKey()); return b; } }
public JobBuilder getJobBuilder() { JobBuilder b = JobBuilder.newJob() .ofType(getJobClass()) .requestRecovery(requestsRecovery()) .storeDurably(isDurable()) .usingJobData(getJobDataMap()) .withDescription(getDescription()) .withIdentity(getKey()); return b; } }
.withIdentity(jobName, jobGroup) .withDescription(jobDescription) .storeDurably(jobDurability) .requestRecovery(jobRecoveryRequested) .build();
.withIdentity(jobName, jobGroup) .withDescription(jobDescription) .storeDurably(jobDurability) .requestRecovery(jobRecoveryRequested) .build();
private JobDetail makeOverseerJob() throws SchedulerException { JobDataMap jdm = new JobDataMap(); jdm.put(PROP_CACHE_MGR_NAME, underlyingCache.getCacheManager().getName()); jdm.put(PROP_CACHE_NAME, underlyingCache.getName()); jdm.put(PROP_CONFIG_OBJECT, config); JobDetail seed = JobBuilder.newJob(OverseerJob.class).storeDurably() .withIdentity(OVERSEER_JOB_NAME, groupName) .usingJobData(jdm).build(); return seed; }
public static JobDetail createJobDetail(JobKey jobKey, Class<? extends Job> jobClass, boolean durable, Map<String, Object> dataMap) { JobDetail jobDetail = newJob(jobClass).withIdentity(jobKey).storeDurably(durable).build(); if (dataMap != null) jobDetail.getJobDataMap().putAll(dataMap); return jobDetail; }
@SuppressWarnings("unchecked") private JobDetail createNormalJobDetail(Class<?> defClass, JobKey jobKey, JobDataMap jobDataMapping) { return JobBuilder.newJob((Class<? extends Job>) defClass) .withIdentity(jobKey) .usingJobData(jobDataMapping) .storeDurably() .build(); }
private JobDetail jobDetail(String jobName, String groupName, PollingReceiverWorker job) { JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put(POLL_CRON_SCHEDULER_JOB, job); return newJob(CronJob.class) .storeDurably() .withIdentity(jobName, groupName) .usingJobData(jobDataMap) .build(); }
/** * Builds a {@link JobDetail} using internal state * * @return */ public JobDetail getJobDetails() { return JobBuilder.newJob(clazz) .withIdentity(name.trim(), group.trim()) .usingJobData(JobDataMapUtils.fromDataMapStr(dataMap)) .storeDurably() .build(); }
public static JobDetail createJobDetailForTask(Task task) { JobDetail job = JobBuilder.newJob(JobExecutor.class) .withIdentity(TaskQuartzImplUtil.createJobKeyForTask(task)) .storeDurably() .requestRecovery() .build(); return job; }
private static JobDetail create(Class<? extends Job> clazz, String jobName, String jobGroup, Map<String, ? extends Object> dataMap, boolean durable) throws SchedulerException { return JobBuilder.newJob(clazz).withIdentity(jobName, jobGroup) .usingJobData(new JobDataMap(dataMap)).storeDurably(durable) .build(); } }
@Override public JobDetail jobDetail(String jarFilePath) { jobDataMap.put(JobDataMapManager.JOB_DESCRIPTOR_KEY, this); if (jarFilePath != null) { jobDataMap.put(JobDataMapManager.JAR_FILE_PATH_KEY, jarFilePath); } return JobBuilder.newJob(StubJob.class) .withIdentity(name(), group()) .storeDurably(true) .setJobData(jobDataMap) .build(); }
private JobDetail makeOverseerJob() throws SchedulerException { JobDataMap jdm = new JobDataMap(); jdm.put(PROP_CACHE_MGR_NAME, underlyingCache.getCacheManager().getName()); jdm.put(PROP_CACHE_NAME, underlyingCache.getName()); jdm.put(PROP_CONFIG_OBJECT, config); JobDetail seed = JobBuilder.newJob(OverseerJob.class).storeDurably() .withIdentity(OVERSEER_JOB_NAME, groupName) .usingJobData(jdm).build(); return seed; }
private JobDetail makeOverseerJob() throws SchedulerException { JobDataMap jdm = new JobDataMap(); jdm.put(PROP_CACHE_MGR_NAME, underlyingCache.getCacheManager().getName()); jdm.put(PROP_CACHE_NAME, underlyingCache.getName()); jdm.put(PROP_CONFIG_OBJECT, config); JobDetail seed = JobBuilder.newJob(OverseerJob.class).storeDurably() .withIdentity(OVERSEER_JOB_NAME, groupName) .usingJobData(jdm).build(); return seed; }
private JobDetail buildJobDetail(ScheduleEmailRequest scheduleEmailRequest) { JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put("email", scheduleEmailRequest.getEmail()); jobDataMap.put("subject", scheduleEmailRequest.getSubject()); jobDataMap.put("body", scheduleEmailRequest.getBody()); return JobBuilder.newJob(EmailJob.class) .withIdentity(UUID.randomUUID().toString(), "email-jobs") .withDescription("Send Email Job") .usingJobData(jobDataMap) .storeDurably() .build(); }
public JobDetail getJobDetails(JobDetail job) { return JobBuilder.newJob(job.getJobClass()) .withIdentity(job.getKey()) .usingJobData(JobDataMapUtils.fromDataMapStr(dataMap)) .storeDurably() .build(); }
private JobDetail getJobDetail(String jobGroup, String jobName, @Nullable String appVersion) { String identity = Strings.isNullOrEmpty(appVersion) ? String.format("developer:application1:flow:%s", jobName) : String.format("developer:application1:%s:flow:%s", appVersion, jobName); return JobBuilder.newJob(LogPrintingJob.class) .withIdentity(identity, jobGroup) .storeDurably() .build(); }
private void createStarterJobIfNeeded() { Scheduler scheduler = taskManager.getExecutionManager().getQuartzScheduler(); try { if (!scheduler.checkExists(STARTER_JOB_KEY)) { JobDetail starterJob = JobBuilder.newJob(JobStarter.class) .withIdentity(STARTER_JOB_KEY) .storeDurably() .build(); scheduler.addJob(starterJob, true); } } catch (SchedulerException e) { throw new SystemException("Starter job couldn't be created", e); } }
private JobDetail addJobDetail(TriggerKey triggerKey, AbstractJob job) throws SchedulerException { Scheduler scheduler = factory.getScheduler(); JobKey jobKey = jobKey(triggerKey.getName(), triggerKey.getGroup()); JobDetail jobDetail; Boolean isJobKeyExist = scheduler.checkExists(jobKey); if (isJobKeyExist) { jobDetail = scheduler.getJobDetail(jobKey); } else { jobDetail = newJob(JobInstance.class).storeDurably().withIdentity (jobKey).build(); } setJobDataMap(jobDetail, job); scheduler.addJob(jobDetail, isJobKeyExist); return jobDetail; }
public void updateExistingJob(Monitor monitor) { JobDetail job = JobBuilder .newJob(MonitorEmailNotificationTask.class) .withIdentity(getIdentity(monitor.getId()), getJobGroupName()) .storeDurably(true).build(); try { springScheduler.getScheduler().getContext().put(job.getKey().getName(), monitor); springScheduler.getScheduler().addJob(job, true); } catch (SchedulerException e) { LOGGER.error("Can't schedule job!"); } }