Results 1 to 3 of 3

Thread: Reusing ItemReaders and ItemWriters

  1. #1
    Join Date
    Apr 2008
    Posts
    174

    Question Reusing ItemReaders and ItemWriters

    I am trying to inject the same writer and reader into my step, only thing that changes is the file name (in case of writer) and sql (in case of reader).

    When I have two steps, the file for the first step gets created without any problem, while the file in the second step is not getting created at all. Do we have any restriction on the reuse of writers? Do we prohibit this in writer?

    Once this is resolved, I need to then check whether the second step correctly picks up the reader with the second SQL. I am using 1.0.1 and I am dynamically changing the file name and SQL in my beforeStep method of StepListener (by injecting the reader and writer into it).

    Thanks!

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

    Default

    I would say in general, you should expect readers and writers to be stateful and not re-use them. There might be a bug there, but the workaround is easy anyway - don't re-use the same instance. Parent bean definitions should work fine for re-using the configuration, but not the same instance.
    Last edited by Dave Syer; Jul 3rd, 2008 at 02:07 AM. Reason: spelling

  3. #3
    Join Date
    Apr 2008
    Posts
    174

    Default

    Thanks Dave!

Posting Permissions

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