Results 1 to 4 of 4

Thread: Interrupting a TaskletStep

  1. #1

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

  2. #2
    Join Date
    Dec 2006
    Posts
    1,061

    Default

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

  3. #3

    Default

    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. #4
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    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
  •