Announcement Announcement Module
No announcement yet.
Interrupting a TaskletStep Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    Couldn't you just return ExitStatus.STOPPED from Tasklet.execute?


    • #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.


      • #4
        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: