/** * Add the given job to the Scheduler, if it doesn't already exist. * Overwrites the job in any case if "overwriteExistingJobs" is set. * @param jobDetail the job to add * @return {@code true} if the job was actually added, * {@code false} if it already existed before * @see #setOverwriteExistingJobs */ private boolean addJobToScheduler(JobDetail jobDetail) throws SchedulerException { if (this.overwriteExistingJobs || getScheduler().getJobDetail(jobDetail.getKey()) == null) { getScheduler().addJob(jobDetail, true); return true; } else { return false; } }
/** * Add the given job to the Scheduler, if it doesn't already exist. * Overwrites the job in any case if "overwriteExistingJobs" is set. * @param jobDetail the job to add * @return {@code true} if the job was actually added, * {@code false} if it already existed before * @see #setOverwriteExistingJobs */ private boolean addJobToScheduler(JobDetail jobDetail) throws SchedulerException { if (this.overwriteExistingJobs || getScheduler().getJobDetail(jobDetail.getKey()) == null) { getScheduler().addJob(jobDetail, true); return true; } else { return false; } }
} else { scheduler.addJob(jobq, true, true); scheduler.rescheduleJob(triggerq.getKey(), triggerq);
private void scheduleOverseerJob() throws SchedulerException { JobDetail seed = makeOverseerJob(); // build our trigger CronScheduleBuilder cronSchedule = CronScheduleBuilder.cronSchedule(config.getCronExpression()); CronTrigger trigger = TriggerBuilder.newTrigger() .withIdentity(OVERSEER_JOB_NAME, groupName) .forJob(seed).withSchedule(cronSchedule) .build(); try { scheduler.addJob(seed, false); } catch (SchedulerException e) { // job already present } try { scheduler.scheduleJob(trigger); } catch (SchedulerException e) { // trigger already present try { scheduler.rescheduleJob(trigger.getKey(), trigger); } catch (SchedulerException ee) { LOG.error("Unable to modify trigger for: " + trigger.getKey()); } } }
public void addJob(JobDetail job, boolean replace, boolean storeNonDurableWhileAwaitingScheduling) { try { scheduler.addJob(job, replace, storeNonDurableWhileAwaitingScheduling); } catch (SchedulerException e) { throw new QuartzRuntimeException(e); } }
public static void add(Scheduler sched, Class<? extends Job> clazz, String jobName, String jobGroup, Map<String, ? extends Object> dataMap) throws SchedulerException { sched.addJob(create(clazz, jobName, jobGroup, dataMap, true), false); }
public void addJob(JobDetail job, boolean replace) { try { scheduler.addJob(job, replace); } catch (SchedulerException e) { throw new QuartzRuntimeException(e); } }
public void addJob(final JobDetail jobDetail, final boolean replace) { try { scheduler.addJob(jobDetail, replace); } catch (final SchedulerException e) { throw new QuartzSchedulerException(e); } }
protected void updateStatus(String groupName, String jobName, String jobStatus) { try { JobDetail jobDetail = scheduler.getJobDetail(jobName, groupName); updateStatus(jobDetail, jobStatus); scheduler.addJob(jobDetail, true); } catch (SchedulerException e) { throw new RuntimeException(new StringBuffer("Caught scheduler exception while updating job status: ").append(jobName).append(", ").append(jobStatus).toString(), e); } }
protected void addJob(JobDetail jobDetail) { try { if ( LOG.isInfoEnabled() ) { LOG.info("Adding job: " + jobDetail.getFullName()); } scheduler.addJob(jobDetail, true); } catch (SchedulerException e) { throw new RuntimeException("Caught exception while adding job: " + jobDetail.getFullName(), e); } }
/** * <p>afterPropertiesSet</p> * * @throws java.lang.Exception if any. */ @Override public void afterPropertiesSet() throws Exception { LOG.debug("Adding job {} to scheduler", m_jobDetail.getKey().getName()); m_scheduler.addJob(m_jobDetail, true); }
public void addScheduled(JobDetail job) { try { job.setGroup(SCHEDULED_GROUP); scheduler.addJob(job, true); } catch (SchedulerException ex) { throw new RuntimeException("Unable to add job to scheduled group: " + job.getName(), ex); } }
public void addUnscheduled(JobDetail job) { try { job.setGroup(UNSCHEDULED_GROUP); scheduler.addJob(job, true); } catch (SchedulerException ex) { throw new RuntimeException("Unable to add job to unscheduled group: " + job.getName(), ex); } }
@Override public void addJob(JobDetail jobDetail, boolean replace) throws QuartzException { try { delegate.addJob(jobDetail, replace); } catch (SchedulerException e) { Logger.error(e.getMessage()); throw new QuartzException(e); } }
@Override public void addJob(JobDetail jobDetail, boolean replace) throws QuartzException { try { delegate.addJob(jobDetail, replace); } catch (SchedulerException e) { Logger.error(e.getMessage()); throw new QuartzException(e); } }
/** * Update existing job with newJobDetail and return the old one. */ public JobDetail updateJobDetail(JobDetail newJobDetail) { try { JobDetail oldJob = scheduler.getJobDetail(newJobDetail.getKey()); scheduler.addJob(newJobDetail, true); return oldJob; } catch (SchedulerException e) { throw new QuartzRuntimeException(e); } }
public void update(IMessage jobMessage, String schedule) throws SchedulerException { JobDetail job = jobFor(jobMessage); scheduler.addJob(job, true, true); Trigger oldTrigger = scheduler.getTrigger(triggerKeyFor(jobMessage)); scheduler.rescheduleJob(oldTrigger.getKey(), triggerFor(schedule, jobMessage)); }
@Before public void setUp() throws Exception { config = Config.getConfig(URI.create("classpath:/test-config"), "builder"); nessJobConfig = config.getConfiguration("ness.job"); scheduler = createMock(Scheduler.class); EasyMock.expect(scheduler.scheduleJob(EasyMock.capture(jobDetailCapture), EasyMock.capture(triggerCapture))).andReturn(null).anyTimes(); scheduler.addJob(EasyMock.capture(jobAddCapture), EasyMock.anyBoolean()); EasyMock.expectLastCall().anyTimes(); replayAll(); }