Mar 5th, 2008, 07:06 AM
Interrupting a TaskletStep
I'm using m5 now, and a TaskletStep to do some custom processing.
I'd like the execution status to change to STOPPED when interrupting the step (in the same way it happens in ItemOrientedStep), but it looks like TaskletStep does not check specifically for the JobInterruptedException i'm throwing so its status is eventually set to FAILED.
Mar 5th, 2008, 03:00 PM
Couldn't you just return ExitStatus.STOPPED from Tasklet.execute?
Mar 6th, 2008, 08:35 AM
Thanks for replying.
ExitStatus doesn't have a STOPPED constant, besides the tasklet exit status is ignored when setting the BatchStatus.
TaskletStep has a pretty simple logic:
If there was no exception set BatchStatus.COMPLETE (regardless of the ExitStatus), if there was - set BatchStatus.FAILED.
ItemOrientedStep checks thrown exceptions for StepInterruptedException, and sets BatchStatus.STOPPED.
I think it would be better to be consistent.
Mar 6th, 2008, 02:02 PM
You're right, ExitStatus and BatchStatus are inconsistent in this regard. I've create an issue for it to be updated:
I took a look at the TaskletStep again and I see what you mean now, if ExitStatus of INTERUPTED is returned, then it will list the job as finishing successful, but if a JobInterupptedException is thrown, it will list it as a normal failure: