Exemple #1
0
 public override void SchedulerError(string msg, SchedulerException cause)
 {
     Log.Error(msg, cause);
 }
Exemple #2
0
        /// <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);
                }
            }
        }
Exemple #3
0
        /// <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;
                }
            }
        }
Exemple #4
0
        /// <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;
                }
            }
        }
Exemple #5
0
        /// <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;
                }
            }
        }
Exemple #6
0
        /// <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;
        }