public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler) { try { return (IJob)InversionControl.Current.Resolve(bundle.JobDetail.JobType); } catch (Exception e) { var se = new SchedulerException("falha ao agendar", e); throw; } }
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler) { try { IJobDetail jobDetail = bundle.JobDetail; Type jobType = jobDetail.JobType; return (IJob)_locator.Resolve(jobType); } catch (Exception e) { var se = new SchedulerException("Problem instantiating class of type", e); throw se; } }
public IJob NewJob(TriggerFiredBundle bundle) { try { var jobDetail = bundle.JobDetail; var jobType = jobDetail.JobType; return (IJob)container.GetInstance(jobType); } catch (Exception e) { var se = new SchedulerException("Problem instantiating class", e); throw se; } }
/// <summary> /// Called by the scheduler at the time of the trigger firing, in order to /// produce a <see cref="IJob" /> instance on which to call Execute. /// </summary> /// <remarks> /// It should be extremely rare for this method to throw an exception - /// basically only the the case where there is no way at all to instantiate /// and prepare the Job for execution. When the exception is thrown, the /// Scheduler will move all triggers associated with the Job into the /// <see cref="TriggerState.Error" /> state, which will require human /// intervention (e.g. an application restart after fixing whatever /// configuration problem led to the issue wih instantiating the Job. /// </remarks> /// <param name="bundle">The TriggerFiredBundle from which the <see cref="JobDetail" /> /// and other info relating to the trigger firing can be obtained.</param> /// <returns>the newly instantiated Job</returns> /// <throws> SchedulerException if there is a problem instantiating the Job. </throws> public virtual IJob NewJob(TriggerFiredBundle bundle) { JobDetail jobDetail = bundle.JobDetail; Type jobType = jobDetail.JobType; try { if (Log.IsDebugEnabled) { Log.Debug(string.Format(CultureInfo.InvariantCulture, "Producing instance of Job '{0}', class={1}", jobDetail.FullName, jobType.FullName)); } return (IJob) ObjectUtils.InstantiateType(jobType); } catch (Exception e) { SchedulerException se = new SchedulerException(string.Format(CultureInfo.InvariantCulture, "Problem instantiating class '{0}'", jobDetail.JobType.FullName), e); throw se; } }
/// <summary> /// Called by the scheduler at the time of the trigger firing, in order to /// produce a <see cref="IJob" /> instance on which to call Execute. /// Instance creation is delegated to the Ninject Kernel. /// </summary> /// <remarks> /// It should be extremely rare for this method to throw an exception - /// basically only the the case where there is no way at all to instantiate /// and prepare the Job for execution. When the exception is thrown, the /// Scheduler will move all triggers associated with the Job into the /// <see cref="TriggerState.Error" /> state, which will require human /// intervention (e.g. an application restart after fixing whatever /// configuration problem led to the issue wih instantiating the Job. /// </remarks> /// <param name="bundle">The TriggerFiredBundle from which the <see cref="IJobDetail" /> /// and other info relating to the trigger firing can be obtained.</param> /// <param name="scheduler"></param> /// <returns>the newly instantiated Job</returns> /// <throws> SchedulerException if there is a problem instantiating the Job. </throws> public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler) { IJobDetail jobDetail = bundle.JobDetail; Type jobType = jobDetail.JobType; try { if (log.IsDebugEnabled) { log.Debug(string.Format(CultureInfo.InvariantCulture, "Producing instance of Job '{0}', class={1}", jobDetail.Key, jobType.FullName)); } return _kernel.Get(jobType) as IJob; } catch (Exception e) { SchedulerException se = new SchedulerException(string.Format(CultureInfo.InvariantCulture, "Problem instantiating class '{0}'", jobDetail.JobType.FullName), e); throw se; } }
public void SchedulerError(string msg, SchedulerException cause) { throw new NotImplementedException(); }
public override void SchedulerError(string msg, SchedulerException cause) { entries.Add(new LogEntry(string.Format("Scheduler error: <pre>{0}</pre><br/><pre>{1}</pre>", WebUtility.HtmlEncode(msg), WebUtility.HtmlEncode(cause.ToString())))); }
public void SchedulerError(string msg, SchedulerException cause) { Console.WriteLine(GetType().Name + ".SchedulerError"); }
public override void SchedulerError(string msg, SchedulerException cause) { Log.Error(msg, cause); }
/// <summary> /// Notifies the scheduler listeners about scheduler error. /// </summary> /// <param name="msg">The MSG.</param> /// <param name="se">The se.</param> public virtual void NotifySchedulerListenersError(string msg, SchedulerException se) { // build a list of all scheduler listeners that are to be notified... IList schedListeners = SchedulerListeners; // notify all scheduler listeners foreach (ISchedulerListener sl in schedListeners) { try { sl.SchedulerError(msg, se); } catch (Exception e) { Log.Error("Error while notifying SchedulerListener of error: ", e); Log.Error(" Original error (for notification) was: " + msg, se); } } }
/// <summary> /// Notifies the job listeners that job was executed. /// </summary> /// <param name="jec">The jec.</param> /// <param name="je">The je.</param> public virtual void NotifyJobListenersWasExecuted(JobExecutionContext jec, JobExecutionException je) { // build a list of all job listeners that are to be notified... IList listeners = BuildJobListenerList(jec.JobDetail.JobListenerNames); // notify all job listeners foreach (IJobListener jl in listeners) { try { jl.JobWasExecuted(jec, je); } catch (Exception e) { SchedulerException se = new SchedulerException(string.Format(CultureInfo.InvariantCulture, "JobListener '{0}' threw exception: {1}", jl.Name, e.Message), e); se.ErrorCode = SchedulerException.ErrorJobListener; throw se; } } }
/// <summary> /// Notifies the trigger listeners of completion. /// </summary> /// <param name="jec">The job executution context.</param> /// <param name="instCode">The instruction code to report to triggers.</param> public virtual void NotifyTriggerListenersComplete(JobExecutionContext jec, SchedulerInstruction instCode) { // build a list of all trigger listeners that are to be notified... IList listeners = BuildTriggerListenerList(jec.Trigger.TriggerListenerNames); // notify all trigger listeners in the list foreach (ITriggerListener tl in listeners) { try { tl.TriggerComplete(jec.Trigger, jec, instCode); } catch (Exception e) { SchedulerException se = new SchedulerException(string.Format(CultureInfo.InvariantCulture, "TriggerListener '{0}' threw exception: {1}", tl.Name, e.Message), e); se.ErrorCode = SchedulerException.ErrorTriggerListener; throw se; } } }
/// <summary> /// Notifies the trigger listeners about misfired trigger. /// </summary> /// <param name="trigger">The trigger.</param> public virtual void NotifyTriggerListenersMisfired(Trigger trigger) { // build a list of all trigger listeners that are to be notified... IList listeners = BuildTriggerListenerList(trigger.TriggerListenerNames); // notify all trigger listeners in the list foreach (ITriggerListener tl in listeners) { try { tl.TriggerMisfired(trigger); } catch (Exception e) { SchedulerException se = new SchedulerException(string.Format(CultureInfo.InvariantCulture, "TriggerListener '{0}' threw exception: {1}", tl.Name, e.Message), e); se.ErrorCode = SchedulerException.ErrorTriggerListener; throw se; } } }
public void SchedulerError(string msg, SchedulerException cause) { Sitecore.Diagnostics.Log.Error(String.Format("Sitecore.QuartzScheuler: SchedulerListener.SchedulerError with Message: \"{0}\" with exception: {1} at {2}", msg, cause.Message + Environment.NewLine + cause.StackTrace, DateTime.Now), this); }
public void SchedulerError(string msg, SchedulerException cause) { //throw new NotImplementedException(); this.Send(string.Format("异常 : {0}\r\n{1}", msg, cause.GetBaseException().StackTrace)); }
public void SchedulerError(String msg, SchedulerException cause) { }
public void SchedulerError(string msg, SchedulerException cause) { Console.WriteLine("SAMPLE: Scheduler error: " + msg + " with exception: " + cause.Message); }
public override void SchedulerError(string msg, SchedulerException cause) { Log.ErrorFormat("An error occurred with the quartz scheduler with message: {0}.", cause, msg); }
/// <summary> /// Called by the IScheduler when a serious error has occurred within the scheduler, /// such as repeated failures in the IJobStore, or the inability to instantiate a IJob /// instance when its ITrigger has fired. /// </summary> /// <param name="message">The error message.</param> /// <param name="cause">The scheduler exception.</param> public void SchedulerError(string message, SchedulerException cause) { Log.DebugFormat("An error occurred in the scheduler: message = '{0}' cause = '{1}'.", message, cause); }
public virtual void SchedulerError(string msg, SchedulerException cause) { }
/// <summary> /// Notifies the trigger listeners about fired trigger. /// </summary> /// <param name="jec">The job execution context.</param> /// <returns></returns> public virtual bool NotifyTriggerListenersFired(JobExecutionContext jec) { // build a list of all trigger listeners that are to be notified... IList listeners = BuildTriggerListenerList(jec.Trigger.TriggerListenerNames); bool vetoedExecution = false; // notify all trigger listeners in the list foreach (ITriggerListener tl in listeners) { try { tl.TriggerFired(jec.Trigger, jec); if (tl.VetoJobExecution(jec.Trigger, jec)) { vetoedExecution = true; } } catch (Exception e) { SchedulerException se = new SchedulerException(string.Format(CultureInfo.InvariantCulture, "TriggerListener '{0}' threw exception: {1}", tl.Name, e.Message), e); se.ErrorCode = SchedulerException.ErrorTriggerListener; throw se; } } return vetoedExecution; }