Skip to content

InitializingTasklet, DisposableTasklet [BATCH-106] #3469

Closed
@spring-projects-issues

Description

@spring-projects-issues

Douglas C. Kaminsky opened BATCH-106 and commented

Request for 2 new interfaces to mirror Spring functionality:

InitializingTasklet: along the lines InitializingBean, defines a contract for some sort of init method which is called once at the beginning of the Step before execute is called for the first time
DisposableTasklet: along the lines of DisposableBean, defines a contract for some sort of destroy method which is called once at the end of the Step after execute is called for the last time

These should be auto-wired via reflection so that if I define a Tasklet which implements either or both of these interfaces, the appropriate method will be called automatically without further effort within the default executors.

Sample use cases: Opening/closing file handles, performing file copy/move/rename operations at the beginning or end of some processing

Existing solutions so far seem insufficient to handle this -

  1. write my own version of tasklet which wraps this and keys off of ExitStatus - this is a hack and non-uniform, which defeats the purpose of using Spring Batch
  2. use a RepeatInterceptor, which forces me to separate logic between the tasklet and the step execution instead of being centrally located - also, seems that I'd have to use a non-default StepExecutor to do this
  3. wire file handles in as beans - doesn't allow dynamic locating and opening of files

Possibly related issue: BATCH-45 (POJO adaptor)


Affects: 1.0-m2

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: corestatus: declinedFeatures that we don't intend to implement or Bug reports that are invalid or missing enough detailstype: feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions