/// <summary> /// Initializes the job execution context with given scheduler and bundle. /// </summary> /// <param name="sched">The scheduler.</param> public virtual void Initialize(QuartzScheduler sched) { qs = sched; IJob job; IJobDetail jobDetail = firedTriggerBundle.JobDetail; try { job = sched.JobFactory.NewJob(firedTriggerBundle, scheduler); } catch (SchedulerException se) { sched.NotifySchedulerListenersError(string.Format(CultureInfo.InvariantCulture, "An error occured instantiating job to be executed. job= '{0}'", jobDetail.Key), se); throw; } catch (Exception e) { SchedulerException se = new SchedulerException(string.Format(CultureInfo.InvariantCulture, "Problem instantiating type '{0}'", jobDetail.JobType.FullName), e); sched.NotifySchedulerListenersError(string.Format(CultureInfo.InvariantCulture, "An error occured instantiating job to be executed. job= '{0}'", jobDetail.Key), se); throw se; } jec = new JobExecutionContextImpl(scheduler, firedTriggerBundle, job); }
/// <summary> /// Initializes the job execution context with given scheduler and bundle. /// </summary> /// <param name="sched">The scheduler.</param> public virtual async Task Initialize(QuartzScheduler sched) { qs = sched; IJob job; IJobDetail jobDetail = firedTriggerBundle.JobDetail; try { job = sched.JobFactory.NewJob(firedTriggerBundle, scheduler); } catch (SchedulerException se) { await sched.NotifySchedulerListenersError($"An error occurred instantiating job to be executed. job= '{jobDetail.Key}'", se).ConfigureAwait(false); throw; } catch (Exception e) { SchedulerException se = new SchedulerException($"Problem instantiating type '{jobDetail.JobType.FullName}'", e); await sched.NotifySchedulerListenersError($"An error occurred instantiating job to be executed. job= '{jobDetail.Key}'", se).ConfigureAwait(false); throw se; } jec = new JobExecutionContextImpl(scheduler, firedTriggerBundle, job); }