@Override public FlowExecutionStatus handle(FlowExecutor executor) throws Exception { return decider.decide(executor.getJobExecution(), executor.getStepExecution()); }
StepExecution stepExecution = executor.getStepExecution(); if (stepExecution != null && executor.getStepExecution().getStatus() == BatchStatus.UNKNOWN) { return FlowExecutionStatus.UNKNOWN; if (!executor.isRestart()) { executor.abandonStepExecution();
/** * Performs any logic to update the exit status for the current flow. * * @param executor {@link FlowExecutor} for the current flow * @param code The exit status to save */ protected void setExitStatus(FlowExecutor executor, String code) { executor.addExitStatus(code); }
@Override public FlowExecutionStatus handle(FlowExecutor executor) throws Exception { /* * On starting a new step, possibly upgrade the last execution to make * sure it is abandoned on restart if it failed. */ executor.abandonStepExecution(); return new FlowExecutionStatus(executor.executeStep(step)); }
StepExecution stepExecution = executor.getStepExecution(); if (stepExecution != null && executor.getStepExecution().getStatus() == BatchStatus.UNKNOWN) { return FlowExecutionStatus.UNKNOWN; if (!executor.isRestart()) { executor.abandonStepExecution(); executor.addExitStatus(code); return status;
/** * Delegate to the flow provided for the execution of the step. * * @see AbstractStep#doExecute(StepExecution) */ @Override protected void doExecute(StepExecution stepExecution) throws Exception { try { stepExecution.getExecutionContext().put(STEP_TYPE_KEY, this.getClass().getName()); StepHandler stepHandler = new SimpleStepHandler(getJobRepository(), stepExecution.getExecutionContext()); FlowExecutor executor = new JobFlowExecutor(getJobRepository(), stepHandler, stepExecution.getJobExecution()); executor.updateJobExecutionStatus(flow.start(executor).getStatus()); stepExecution.upgradeStatus(executor.getJobExecution().getStatus()); stepExecution.setExitStatus(executor.getJobExecution().getExitStatus()); } catch (FlowExecutionException e) { if (e.getCause() instanceof JobExecutionException) { throw (JobExecutionException) e.getCause(); } throw new JobExecutionException("Flow execution ended unexpectedly", e); } }
stepExecution = executor.getStepExecution(); executor.close(new FlowExecution(stateName, status)); throw e; executor.close(new FlowExecution(stateName, status)); throw new FlowExecutionException(String.format("Ended flow=%s at state=%s with exception", name, stateName), e); executor.close(result); return result;
@Override public FlowExecutionStatus handle(FlowExecutor executor) throws Exception { FlowExecutionStatus result = super.handle(executor); executor.getJobExecution().getExecutionContext().put("batch.lastSteps", Collections.singletonList(getStep().getName())); return result; } }
@Override protected void setExitStatus(FlowExecutor executor, String code) { StepExecution stepExecution = executor.getStepExecution(); ExitStatus status = new ExitStatus(code); if(!ExitStatus.isNonDefaultExitStatus(status)) { stepExecution.getJobExecution().setExitStatus(status); } } }
/** * Delegate to the flow provided for the execution of the step. * * @see AbstractStep#doExecute(StepExecution) */ @Override protected void doExecute(StepExecution stepExecution) throws Exception { try { stepExecution.getExecutionContext().put(STEP_TYPE_KEY, this.getClass().getName()); StepHandler stepHandler = new SimpleStepHandler(getJobRepository(), stepExecution.getExecutionContext()); FlowExecutor executor = new JobFlowExecutor(getJobRepository(), stepHandler, stepExecution.getJobExecution()); executor.updateJobExecutionStatus(flow.start(executor).getStatus()); stepExecution.upgradeStatus(executor.getJobExecution().getStatus()); stepExecution.setExitStatus(executor.getJobExecution().getExitStatus()); } catch (FlowExecutionException e) { if (e.getCause() instanceof JobExecutionException) { throw (JobExecutionException) e.getCause(); } throw new JobExecutionException("Flow execution ended unexpectedly", e); } }
@Override public FlowExecutionStatus handle(FlowExecutor executor) throws Exception { /* * On starting a new step, possibly upgrade the last execution to make * sure it is abandoned on restart if it failed. */ executor.abandonStepExecution(); return new FlowExecutionStatus(executor.executeStep(step)); }
logger.debug("Handling state="+stateName); status = state.handle(executor); stepExecution = executor.getStepExecution(); executor.close(new FlowExecution(stateName, status)); throw e; executor.close(new FlowExecution(stateName, status)); throw new FlowExecutionException(String.format("Ended flow=%s at state=%s with exception", name, stateName), e); executor.close(result); return result;
/** * Resets the {@link JobExecution}'s exit status before aggregating the results of the flows within * the split. * * @param results the {@link FlowExecution}s from each of the flows executed within this split * @param executor the {@link FlowExecutor} used to execute the flows */ @Override protected FlowExecutionStatus doAggregation(Collection<FlowExecution> results, FlowExecutor executor) { List<String> stepNames = new ArrayList<>(); for (Flow curFlow : getFlows()) { JsrFlow flow = (JsrFlow) curFlow; if(flow.getMostRecentStepName() != null) { stepNames.add(flow.getMostRecentStepName()); } } if(!stepNames.isEmpty()) { executor.getJobExecution().getExecutionContext().put("batch.lastSteps", stepNames); } executor.getJobExecution().setExitStatus(null); return super.doAggregation(results, executor); } }
@Override protected void setExitStatus(FlowExecutor executor, String code) { StepExecution stepExecution = executor.getStepExecution(); ExitStatus status = new ExitStatus(code); if(!ExitStatus.isNonDefaultExitStatus(status)) { stepExecution.getJobExecution().setExitStatus(status); } } }
StepExecution stepExecution = executor.getStepExecution(); if (stepExecution != null && executor.getStepExecution().getStatus() == BatchStatus.UNKNOWN) { return FlowExecutionStatus.UNKNOWN; jobRepository.updateExecutionContext(jobExecution); if (!executor.isRestart()) { executor.abandonStepExecution();
@Override public FlowExecutionStatus handle(FlowExecutor executor) throws Exception { return decider.decide(executor.getJobExecution(), executor.getStepExecution()); }
/** * Delegate to the flow provided for the execution of the step. * * @see AbstractStep#doExecute(StepExecution) */ @Override protected void doExecute(StepExecution stepExecution) throws Exception { try { stepExecution.getExecutionContext().put(STEP_TYPE_KEY, this.getClass().getName()); StepHandler stepHandler = new SimpleStepHandler(getJobRepository(), stepExecution.getExecutionContext()); FlowExecutor executor = new JobFlowExecutor(getJobRepository(), stepHandler, stepExecution.getJobExecution()); executor.updateJobExecutionStatus(flow.start(executor).getStatus()); stepExecution.upgradeStatus(executor.getJobExecution().getStatus()); stepExecution.setExitStatus(executor.getJobExecution().getExitStatus()); } catch (FlowExecutionException e) { if (e.getCause() instanceof JobExecutionException) { throw (JobExecutionException) e.getCause(); } throw new JobExecutionException("Flow execution ended unexpectedly", e); } }
@Override public FlowExecutionStatus handle(FlowExecutor executor) throws Exception { /* * On starting a new step, possibly upgrade the last execution to make * sure it is abandoned on restart if it failed. */ executor.abandonStepExecution(); return new FlowExecutionStatus(executor.executeStep(step)); }
stepExecution = executor.getStepExecution(); executor.close(new FlowExecution(stateName, status)); throw e; executor.close(new FlowExecution(stateName, status)); throw new FlowExecutionException(String.format("Ended flow=%s at state=%s with exception", name, stateName), e); executor.close(result); return result;