示例#1
0
        /// <summary>
        /// @see IflowExecutor#ExecuteStep .
        /// </summary>
        /// <param name="step"></param>
        /// <returns></returns>
        /// <exception cref="JobInterruptedException"></exception>
        /// <exception cref="JobRestartException"></exception>
        /// <exception cref="StartLimitExceededException"></exception>
        public string ExecuteStep(IStep step)
        {
            bool          isRerun       = IsStepRestart(step);
            StepExecution stepExecution = _stepHandler.HandleStep(step, _execution);

            _stepExecutionHolder.Value = stepExecution;

            if (stepExecution == null)
            {
                return(ExitStatus.Completed.ExitCode);
            }
            if (stepExecution.TerminateOnly)
            {
                throw new JobInterruptedException(string.Format("Step requested termination: {0}", stepExecution), stepExecution.BatchStatus);
            }

            if (isRerun)
            {
                stepExecution.ExecutionContext.Put("batch.restart", true);
            }

            return(stepExecution.ExitStatus.ExitCode);
        }
示例#2
0
 /// <summary>
 /// Convenience method for subclasses to delegate the handling of a specific
 /// step in the context of the current <see cref="JobExecution"/> . Clients of this
 /// method do not need access to the <see cref="JobRepository"/>, nor do they need
 /// to worry about populating the execution context on a restart, nor
 /// detecting the interrupted state (in job or step execution).
 /// </summary>
 /// <param name="step">the step to execute</param>
 /// <param name="execution">the current job execution</param>
 /// <returns></returns>
 /// <exception cref="JobInterruptedException"></exception>
 /// <exception cref="JobRestartException"></exception>
 /// <exception cref="StartLimitExceededException"></exception>
 protected StepExecution HandleStep(IStep step, JobExecution execution)
 {
     return(_stepHandler.HandleStep(step, execution));
 }