예제 #1
0
        public virtual void Delete(bool incidentResolved)
        {
            //throw new NotImplementedException();
            CommandContext commandContext = Context.CommandContext;

            IncrementSequenceCounter();

            // clean additional data related to this job
            IJobHandler jobHandler = JobHandler;

            if (jobHandler != null)
            {
                jobHandler.OnDelete(JobHandlerConfiguration, this);
            }

            // fire delete event if this job is not being executed
            bool executingJob = this.Equals(commandContext.CurrentJob);

            commandContext.JobManager.DeleteJob(this, !executingJob);

            // Also delete the job's exception byte array
            if (ExceptionByteArrayId != null)
            {
                commandContext.ByteArrayManager.DeleteByteArrayById(ExceptionByteArrayId);
            }

            // remove link to execution
            ExecutionEntity execution = Execution;

            if (execution != null)
            {
                execution.RemoveJob(this);
            }

            RemoveFailedJobIncident(incidentResolved);
        }