Skip to content

job/step setup should be separated from execution [BATCH-372] #3207

Closed
@spring-projects-issues

Description

@spring-projects-issues

Robert Kasanicky opened BATCH-372 and commented

Currently setup of the job/step execution (figuring out whether it should be run and whether it is being restarted) is part of the execute() method rather than being dealt with separately. This has some bad consequences - even when we create a fresh job instance, both job and step investigate their execution counts and last executions. It doesn't make sense as it is clear execution count must be zero and there is no last execution. Assuming a job instance is usually executed successfully and restart is an exceptional scenario makes the current state look even more awkward.

I imagine the basic execution flow should be something like:

if (findJobInstance(job, params) == null) {
createJobInstance()
setupVanillaExecution()
}
else {
restoreFromLastExecution()
}
execute() //no dealing with past here anymore, just straightforward execution

rather than current:

1.findOrCreateJobInstance(..)
2.execute(..) // checking what scenario I'm in all the time

The proposed approach clearly points finger at the DDD-hostile findOrCreateJobInstance(..) method which should be broken into two, but also moves towards removing lastExecution and executionCount properties from JobInstance as they become relevant only in the narrow context of restoreFromLastExecution().


Issue Links:

  • BATCH-375 separate optional features from core framework

  • BATCH-375 separate optional features from core framework

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: declinedFeatures that we don't intend to implement or Bug reports that are invalid or missing enough detailstype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions