/// <summary> /// Job interruption handling. /// </summary> /// <param name="execution"></param> /// <param name="e"></param> private void HandleJobInterruptedException(JobExecution execution, JobInterruptedException e) { Logger.Info("Encountered interruption executing job: " + e.Message); Logger.Debug(e, "Full exception"); execution.ExitStatus = GetDefaultExitStatusForFailure(e, execution); execution.Status = BatchStatus.Max(BatchStatus.Stopped, e.Status); execution.AddFailureException(e); }
public void MaxTest() { BatchStatus low = BatchStatus.Completed; BatchStatus hi = BatchStatus.Failed; BatchStatus max = BatchStatus.Max(low, hi); Assert.AreEqual(hi, max); }
/// <summary> /// Aggregates the input executions into the result <see cref="StepExecution"/>. /// The aggregated fields are: /// <list type="table"> /// <item> /// <term>BatchStatus</term> /// <description>using the highest value using <see cref="BatchStatus.Max"/></description> /// </item> /// <item> /// <term>ExitStatus</term> /// <description>using <see cref="ExitStatus.And"/></description> /// </item> /// <item> /// <term>counters (e.g., CommitCount, RollbackCount)</term> /// <description>by arithmetic sum</description> /// </item> /// </list> /// </summary> /// <param name="result">the result to overwrite</param> /// <param name="executions">the inputs</param> public void Aggregate(StepExecution result, ICollection <StepExecution> executions) { Assert.NotNull(result, "To aggregate into a result it must be non-null."); if (executions == null) { return; } foreach (var stepExecution in executions) { result.BatchStatus = BatchStatus.Max(result.BatchStatus, stepExecution.BatchStatus); result.ExitStatus = result.ExitStatus.And(stepExecution.ExitStatus); result.FilterCount = result.FilterCount + stepExecution.FilterCount; result.ProcessSkipCount = result.ProcessSkipCount + stepExecution.ProcessSkipCount; result.CommitCount = result.CommitCount + stepExecution.CommitCount; result.RollbackCount = result.RollbackCount + stepExecution.RollbackCount; result.ReadCount = result.ReadCount + stepExecution.ReadCount; result.ReadSkipCount = result.ReadSkipCount + stepExecution.ReadSkipCount; result.WriteCount = result.WriteCount + stepExecution.WriteCount; result.WriteSkipCount = result.WriteSkipCount + stepExecution.WriteSkipCount; } }