org.springframework.batch.core.listener.StepExecutionListenerSupport Java Examples

The following examples show how to use org.springframework.batch.core.listener.StepExecutionListenerSupport. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringBatchFlowRunner.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
private StepExecutionListener releaserListener(NamedArgumentsSupplier argsSupplier,
		ReleaserTask releaserTask) {
	return new StepExecutionListenerSupport() {
		@Override
		public ExitStatus afterStep(StepExecution stepExecution) {
			Arguments args = argsSupplier.get();
			FlowRunner.Decision decision = afterTask(args.options, args.properties,
					releaserTask);
			if (decision == FlowRunner.Decision.ABORT) {
				return ExitStatus.FAILED;
			}
			ExecutionResult result = (ExecutionResult) stepExecution
					.getExecutionContext().get("result");
			if (result == null || result.isSuccess()) {
				return stepExecution.getExitStatus();
			}
			else if (result.isUnstable()) {
				return ExitStatus.COMPLETED
						.addExitDescription(BuildUnstableException.DESCRIPTION);
			}
			else if (result.isFailure()) {
				return ExitStatus.FAILED;
			}
			return ExitStatus.COMPLETED;
		}
	};
}