Announcement Announcement Module
No announcement yet.
Why is SimpleFlatFileInputSource a DisposableBean? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why is SimpleFlatFileInputSource a DisposableBean?


    I'm currently investigating spring batch for use in one of our customer's projects. I tried to figure out how to meet the following requirement for an import job: "Move the file to a processed folder if the import ist complete"

    I have the problem that SimpleFlatFileInputSource keeps the file handle as long as it is alive in the container. I wonder how I could implement such a requirement mentioned above inside the container?

    I don't really understand why the SimpleFlatFileInputSource has to hold the handle as long as it is alive. Wouldn't it be possible to close the file handle when readLine() in line 190 returns null?

    I'm using 1.0.0.m3. Any help or suggestions how I can implement such a functionality or anything to enlight my path is appreciated.


  • #2
    You are meant to use these stateful components in scope="step", and that way the file will be closed when the step is complete. Probably the best way to implement your "file copy on complete" requirement is to use a separate step.