Ejemplo n.º 1
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;
                }
            }
        }
Ejemplo n.º 2
0
 public virtual void JobWasExecuted(JobExecutionContext context, JobExecutionException jobException)
 {
     lock (executingJobs.SyncRoot)
     {
         executingJobs.Remove(context.Trigger.FireInstanceId);
     }
 }
Ejemplo n.º 3
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;
		}