Beispiel #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="args"></param>
 public virtual void JobHasCompleted(JobCompleteArguments args)
 {
     PostRun(args);
     Interlocked.Decrement(ref numJobsToRun);
     if (numJobsToRun == 0)
     {
         PostAllRuns();
     }
     Completed?.Invoke(this, new EventArgs());
 }
Beispiel #2
0
        /// <summary>
        /// Invoke the job completed event.
        /// </summary>
        /// <param name="job"></param>
        /// <param name="jobManager"></param>
        /// <param name="startTime"></param>
        /// <param name="error"></param>
        protected void InvokeJobCompleted(IRunnable job, IJobManager jobManager, DateTime startTime, Exception error)
        {
            var finishTime = DateTime.Now;
            var arguments  = new JobCompleteArguments()
            {
                Job = job,
                ExceptionThrowByJob = error,
                ElapsedTime         = finishTime - startTime
            };

            jobManager.JobHasCompleted(arguments);
            JobCompleted?.Invoke(this, arguments);
        }
Beispiel #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="args"></param>
 public virtual void JobHasCompleted(JobCompleteArguments args)
 {
     PostRun(args);
     Interlocked.Decrement(ref numJobsToRun);
     // Modulus arithmetic. This is a hack to allow the server job runner
     // to reuse the same job manager object across multiple runs. Ideally,
     // this should all be refactored out, possibly by making PostAllRuns()
     // get called from outside of this class, by something with enough
     // context to know when it needs to be called. What should really happen
     // is that the numJobsToRun variable gets set to NumJobs when a run
     // (of all jobs 'owned' by this job manager) first starts.
     // numJobsToRun should also probably be uint.
     if (numJobsToRun < 0)
     {
         numJobsToRun = NumJobs - 1;
     }
     if (numJobsToRun == 0)
     {
         PostAllRuns();
         Completed?.Invoke(this, new EventArgs());
     }
 }
Beispiel #4
0
 /// <summary>Called once when all jobs have completed running. Should throw on error.</summary>
 protected virtual void PostRun(JobCompleteArguments args)
 {
 }