Esempio n. 1
0
 public virtual void JobWasExecuted(JobExecutionContext context, JobExecutionException jobException)
 {
     lock (executingJobs.SyncRoot)
     {
         executingJobs.Remove(context.Trigger.FireInstanceId);
     }
 }
Esempio n. 2
0
 public virtual void JobExecutionVetoed(JobExecutionContext context)
 {
 }
Esempio n. 3
0
        public virtual void JobToBeExecuted(JobExecutionContext context)
        {
            numJobsFired++;

            lock (executingJobs.SyncRoot)
            {
                executingJobs[context.Trigger.FireInstanceId] = context;
            }
        }
Esempio n. 4
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;
                }
            }
        }
Esempio n. 5
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;
                }
            }
        }
Esempio n. 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;
        }
Esempio n. 7
0
		/// <summary> 
		/// Called after the <see cref="IScheduler" /> has executed the 
		/// <see cref="JobDetail" /> associated with the <see cref="Trigger" /> in order
		/// to get the final instruction code from the trigger.
		/// </summary>
		/// <param name="jobCtx">
		/// The <see cref="JobExecutionContext" /> that was used by the
		/// <see cref="IJob" />'s <see cref="IJob.Execute" /> method.
		/// </param>
		/// <param name="result">
		/// The <see cref="JobExecutionException" /> thrown by the
		/// <see cref="IJob" />, if any (may be <see langword="null" />)
		/// </param>
		/// <returns> one of the Trigger.INSTRUCTION_XXX constants.
		/// </returns>
        public override SchedulerInstruction ExecutionComplete(JobExecutionContext jobCtx, JobExecutionException result)
		{
			if (result != null && result.RefireImmediately)
			{
                return SchedulerInstruction.ReExecuteJob;
			}

			if (result != null && result.UnscheduleFiringTrigger)
			{
                return SchedulerInstruction.SetTriggerComplete;
			}

			if (result != null && result.UnscheduleAllTriggers)
			{
                return SchedulerInstruction.SetAllJobTriggersComplete;
			}

			if (!GetMayFireAgain())
			{
                return SchedulerInstruction.DeleteTrigger;
			}

            return SchedulerInstruction.NoInstruction;
		}