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

  • Abandoned

    I have a simlar problem to the one sidetracked to at the end of this thread

    I have a job that will process items, and when a certain business exception occurs I skip those and mark them for later processing. This is carried out in a subsequent step.

    The problem arises when a 'hard failure' occurs (I.e when an item is impossible to process due to a formatting error) . This step then fails, but (as Dave points out in the thread) since the 'cleanup' step that runs subsequently the FAILED step is marked as ABANDONED. Therefore the step can not be restarted. (using Spring batch 2.0.3, I cant see anything changing this fact in 2.1, but I might be wrong...)

    I am trying to force a status of FAILED back onto that step, but that is not reflected in the DB afterwards.

    The Code that is attempting a force

    for (StepExecution execution : stepExecution.getJobExecution().getStepExecutions()) {
                if(execution.getStepName().equals(PROCESSING_STEP) && execution.getStatus().equals(BatchStatus.ABANDONED)){
                    execution.upgradeStatus(BatchStatus.FAILED); // setStatus(BatchStatus.FAILED)

    Now i suspect that at this time the damage is already done, the stepExecution status is written to the DB and will not be updated.
    It does not work in the step that fails either, as the exit status at that point is FAILED.

    Modifying the DB value itself works, but I would rather not code that into the process, it feels like a pretty dirty hack...


    With the following addition the DB status is updated..
    But the relies on injecting the jobRepository!!

    Appreciate any suggestions....


    Last edited by jelmstrom; Jun 11th, 2010, 07:50 AM. Reason: hacked a workaround