public override void Init(CommandContext commandContext) { // clean additional data related to this job IJobHandler jobHandler = JobHandler; jobHandler?.OnDelete(JobHandlerConfiguration, this); //cancel the retries -> will resolve job incident if present Retries = commandContext.ProcessEngineConfiguration.DefaultNumberOfRetries; //delete the job's exception byte array and exception message string exceptionByteArrayIdToDelete = null; if (ExceptionByteArrayId != null) { exceptionByteArrayIdToDelete = ExceptionByteArrayId; this.ExceptionByteArrayId = null; this.exceptionMessage = null; } //clean the lock information LockOwner = null; LockExpirationTime = null; if (exceptionByteArrayIdToDelete != null) { //ByteArrayEntity byteArray = commandContext.GetDbEntityManager<ByteArrayEntity>().getDbEntityManager().selectById(ByteArrayEntity.class, exceptionByteArrayIdToDelete); var byteArray = commandContext.GetDbEntityManager <ResourceEntity>().Get(exceptionByteArrayIdToDelete); commandContext.GetDbEntityManager <ResourceEntity>().Delete(byteArray); } }
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); }