Spring Batch
  1. Spring Batch
  2. BATCH-435

TaskletStep does not report interruption correctly.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0.m5
    • Fix Version/s: 1.0.0.rc1
    • Component/s: Core
    • Labels:
      None

      Description

      The TaskletStep doesn't store that a job was interrupted correctly. For example, if someone implements a tasklet that returns ExitStatus.INTERUPTED, a BatchStatus of FINISHED will be returned, which is not ideal. Also, if a JobInterruptedException is thrown, a BatchStatus of FAILED will be stored, instead of STOPPED.

        Activity

        Hide
        Robert Kasanicky added a comment -

        I think the ExitStatus.INTERRUPTED should be removed and the JobInterruptedException should be used to signal interruption uniformly.

        Show
        Robert Kasanicky added a comment - I think the ExitStatus.INTERRUPTED should be removed and the JobInterruptedException should be used to signal interruption uniformly.
        Hide
        Robert Kasanicky added a comment - - edited

        Afterall the current state makes sense to me - why should the step care whether it failed or was interrupted? The step simply failed due to interruption - the BatchStatus.STOPPED on JobExecution says it all. Adding interruption handling on step level seems like an unnecessary duplication to me - the step can safely ignore interrupt concerns (if we switch to using the interrupt aspect anyway).

        Show
        Robert Kasanicky added a comment - - edited Afterall the current state makes sense to me - why should the step care whether it failed or was interrupted? The step simply failed due to interruption - the BatchStatus.STOPPED on JobExecution says it all. Adding interruption handling on step level seems like an unnecessary duplication to me - the step can safely ignore interrupt concerns (if we switch to using the interrupt aspect anyway).
        Hide
        Assaf Berg added a comment -

        I think the problem with TaskletStep is that it catches JobInterruptedException and treats it like any other exception - marks the batch as failed. Instead, it should let the JobInterruptedException propagate to the job (as ItemOrientedStep does), which will set the status to STOPPED.

        Show
        Assaf Berg added a comment - I think the problem with TaskletStep is that it catches JobInterruptedException and treats it like any other exception - marks the batch as failed. Instead, it should let the JobInterruptedException propagate to the job (as ItemOrientedStep does), which will set the status to STOPPED.
        Hide
        Dave Syer added a comment -

        I agree with that analysis. There is some value in the STOPPED status. The only slight flow is that most Tasklets will never throw that exception, but I guess that should matter to the step implementation.

        Show
        Dave Syer added a comment - I agree with that analysis. There is some value in the STOPPED status. The only slight flow is that most Tasklets will never throw that exception, but I guess that should matter to the step implementation.
        Hide
        Robert Kasanicky added a comment -

        TaskletStep now rethrows JobInterruptedException without wrapping it

        Show
        Robert Kasanicky added a comment - TaskletStep now rethrows JobInterruptedException without wrapping it
        Hide
        Dave Syer added a comment -

        Assume closed as resolved and released

        Show
        Dave Syer added a comment - Assume closed as resolved and released

          People

          • Assignee:
            Robert Kasanicky
            Reporter:
            Lucas Ward
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified