Results 1 to 3 of 3

Thread: ExitStatus and how should a Tasklet cause a Job to fail?

  1. #1

    Default ExitStatus and how should a Tasklet cause a Job to fail?

    Newbie question: I want a Job to fail if certain criteria are not met within a Tasklet (being invoked via TaskletStep). I assumed that returning ExitStatus.FAILED from the execute method would do this, but it looks like the only way to cause a Job to fail is to throw an exception from a Tasklet.

    Is this correct and what is the meaning of ExitStatus in this context - does it have any effect on behaviour of Job?
    Last edited by ndw; Mar 26th, 2008 at 02:45 PM. Reason: Typo in ExitStatus

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

    Default

    That is correct, throwing an exception from Tasklet indicates that it failed, and returning an ExitStatus of any type indicates that it finished successfully. The value of the ExitStatus is really just there for reporting purposes (we store the exit code in the meta data tables)

  3. #3
    Join Date
    Jun 2005
    Posts
    4,232

    Default

    Arguably we should change the signature of Tasklet to make this more obvious - there is not reason for it ever to return ExitStatus.CONTINUABLE. It's just nice to have the exit code and exit description in the database.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •