-
Mar 5th, 2008, 07:06 AM
#1
Interrupting a TaskletStep
Hi,
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
#2
Couldn't you just return ExitStatus.STOPPED from Tasklet.execute?
-
Mar 6th, 2008, 08:35 AM
#3
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
#4
You're right, ExitStatus and BatchStatus are inconsistent in this regard. I've create an issue for it to be updated:
http://jira.springframework.org/browse/BATCH-434
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:
http://jira.springframework.org/browse/BATCH-435
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