-
Dec 21st, 2008, 06:38 AM
#1
AbstractStep and failed steps
Hi,
i am new to Spring batch and I have a question regarding the usage of AbstractStep. I have a step class that extends it and in case of an in-complete execution, the execute method returns ExitStatus.CONTINUABLE. I think that AbstractStep's doExecute, returns a status of Completed and there for my job, which only contains this single step, is not allowed to re-execute with the same parameters?
is there a way of setting the exitStatus to failed without throwing an exception from the step's execute?
thanks everybody,
shahar
-
Dec 21st, 2008, 11:44 AM
#2
Actually, not being able to start multiple instances of the same Job is considered to be an important feature by design (as per the user guide). If you want to subvert that you can set the allowStartIfComplete flag on the Step (if you use one of the out of the box factory beeans).
It shouldn't be necessary to implement the Step interface to achieve anything as simple as a status change. You can set the status using a listener. We usually recommend STOPPED (not FAILED) for a Job/Step that has been paused and will be restarted manually, which sounds like your use case. (Note also that in 2.0 a Step is no longer expected to throw an exception on failure, but that's a detail.)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules