Results 1 to 2 of 2

Thread: Why is SimpleFlatFileInputSource a DisposableBean?

  1. #1

    Question Why is SimpleFlatFileInputSource a DisposableBean?

    Hi,

    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.

    Thanks,
    Fabian

  2. #2
    Join Date
    Jun 2005
    Posts
    4,232

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •