List of usage examples for org.springframework.batch.core.job.flow FlowExecution FlowExecution
public FlowExecution(String name, FlowExecutionStatus status)
From source file:org.springframework.batch.core.job.flow.support.SimpleFlow.java
/** * @see Flow#resume(String, FlowExecutor) */// w w w. j a v a 2 s .c o m @Override public FlowExecution resume(String stateName, FlowExecutor executor) throws FlowExecutionException { FlowExecutionStatus status = FlowExecutionStatus.UNKNOWN; State state = stateMap.get(stateName); if (logger.isDebugEnabled()) { logger.debug("Resuming state=" + stateName + " with status=" + status); } StepExecution stepExecution = null; // Terminate if there are no more states while (isFlowContinued(state, status, stepExecution)) { stateName = state.getName(); try { if (logger.isDebugEnabled()) { logger.debug("Handling state=" + stateName); } status = state.handle(executor); stepExecution = executor.getStepExecution(); } catch (FlowExecutionException e) { executor.close(new FlowExecution(stateName, status)); throw e; } catch (Exception e) { executor.close(new FlowExecution(stateName, status)); throw new FlowExecutionException( String.format("Ended flow=%s at state=%s with exception", name, stateName), e); } if (logger.isDebugEnabled()) { logger.debug("Completed state=" + stateName + " with status=" + status); } state = nextState(stateName, status, stepExecution); } FlowExecution result = new FlowExecution(stateName, status); executor.close(result); return result; }