@Override public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException { Job job = super.newJob(bundle, scheduler); JobDataMap jobDataMap = new JobDataMap(); jobDataMap.putAll(scheduler.getContext()); jobDataMap.putAll(bundle.getJobDetail().getJobDataMap()); jobDataMap.putAll(bundle.getTrigger().getJobDataMap()); setBeanProps(job, jobDataMap); return job; }
@Override public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException { Job job = super.newJob(bundle, scheduler); JobDataMap jobDataMap = new JobDataMap(); jobDataMap.putAll(scheduler.getContext()); jobDataMap.putAll(bundle.getJobDetail().getJobDataMap()); jobDataMap.putAll(bundle.getTrigger().getJobDataMap()); setBeanProps(job, jobDataMap); return job; }
@Override public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException { final Job job = super.newJob(bundle, scheduler); Injections.inject(job, servletContext, null); return new Job() { @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { job.execute(jobExecutionContext); try { //In a different class to make the database module optional at runtime SessionCleaner.closeSessions(servletContext); } catch (NoClassDefFoundError e) { logger.debug("Database module not available, not closing sessions", e); } } }; }
@Override public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException { final Job job = super.newJob(bundle, scheduler); applicationContext.getAutowireCapableBeanFactory().autowireBean(job); return jobExecutionContext -> { job.execute(jobExecutionContext); try { //In a different class to make the database module optional at runtime SessionCleaner.closeSessions(applicationContext); } catch (NoClassDefFoundError e) { logger.debug("Database module not available, not closing sessions", e); } }; }
@Override public Job newJob(final TriggerFiredBundle bundle) throws SchedulerException { final JobDetail jobDetail = bundle.getJobDetail(); if (Quartz1Job.class.equals(jobDetail.getJobClass())) { return new Quartz1Job(schedulerService, schedulerRunMode, bundle); } return new ClassLoaderProtectingWrappedJob(super.newJob(bundle), schedulerService); }
@Override public Job newJob(final TriggerFiredBundle bundle, final Scheduler scheduler) throws SchedulerException { final Job newJob = super.newJob(bundle, scheduler); if (newJob instanceof AbstractQuartzJob) { final AbstractQuartzJob quartzJob = (AbstractQuartzJob) newJob; final JobDataMap jobDataMap = bundle.getJobDetail().getJobDataMap(); final Long tenantId = Long.valueOf((String) jobDataMap.get("tenantId")); final Long jobId = Long.valueOf((String) jobDataMap.get("jobId")); final String jobName = (String) jobDataMap.get("jobName"); final JobIdentifier jobIdentifier = new JobIdentifier(jobId, tenantId, jobName); try { quartzJob.setBosJob(schedulerService.getPersistedJob(jobIdentifier)); } catch (final Throwable t) { if (isInternalCronJob(jobName)) { logExecutionIgnored(bundle, jobName, t); quartzJob.setBosJob(null); } else { throw new org.quartz.SchedulerException("unable to create the BOS job", t); } } return quartzJob; } // FIXME a job that is not a BOS job was scheduled... not possible return newJob; }
@Override public Job newJob(final TriggerFiredBundle bundle, final Scheduler scheduler) throws SchedulerException { final Job newJob = super.newJob(bundle, scheduler); if (newJob instanceof AbstractQuartzJob) { final AbstractQuartzJob quartzJob = (AbstractQuartzJob) newJob; final JobDataMap jobDataMap = bundle.getJobDetail().getJobDataMap(); final Long tenantId = Long.valueOf((String) jobDataMap.get("tenantId")); final Long jobId = Long.valueOf((String) jobDataMap.get("jobId")); final String jobName = (String) jobDataMap.get("jobName"); final JobIdentifier jobIdentifier = new JobIdentifier(jobId, tenantId, jobName); try { quartzJob.setBosJob(schedulerService.getPersistedJob(jobIdentifier)); } catch (final Throwable t) { if (isInternalCronJob(jobName)) { logExecutionIgnored(bundle, jobName, t); quartzJob.setBosJob(null); } else { throw new org.quartz.SchedulerException("unable to create the BOS job", t); } } return quartzJob; } // FIXME a job that is not a BOS job was scheduled... not possible return newJob; }
public Job newJob(TriggerFiredBundle bundle) throws SchedulerException { Job job = super.newJob(bundle); JobDataMap jobDataMap = new JobDataMap(); jobDataMap.putAll(bundle.getJobDetail().getJobDataMap()); jobDataMap.putAll(bundle.getTrigger().getJobDataMap()); setBeanProps(job, jobDataMap); return job; }
public Job newJob(TriggerFiredBundle bundle) throws SchedulerException { Job job = super.newJob(bundle); JobDataMap jobDataMap = new JobDataMap(); jobDataMap.putAll(bundle.getJobDetail().getJobDataMap()); jobDataMap.putAll(bundle.getTrigger().getJobDataMap()); setBeanProps(job, jobDataMap); return job; }