Results 1 to 10 of 10

Thread: Making ItemReader threadsafe

Hybrid View

  1. #1
    Join Date
    Jun 2010
    Posts
    15

    Default Making ItemReader threadsafe

    How do we make the StoredProcedureItemReader thread-safe?

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

    Default

    You can synchronize the read() method (e.g. by wrapping it in a delegator that does the synchronization). Remember that you will lose restartability, so best practice is to mark the step as not restartable and to be safe (and efficient) you can also set saveState=false on the reader.

  3. #3
    Join Date
    Jun 2010
    Posts
    15

    Default Multi thread fails...

    I am running the StoredProcedureItemReader in a multithreaded fasion. I get the below error
    Encountered an error executing the step
    org.springframework.dao.InvalidDataAccessResourceU sageException: Unexpected cursor position change.

    when I run in single threaded mode I dont have this issue....

  4. #4
    Join Date
    Jun 2010
    Posts
    15

    Default

    I am using the spring class StoredprocedureItemReader....How do i synchronise the read method then?

  5. #5
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    Did you try my original suggestion: "wrapping it in a delegator that does the synchronization"?

  6. #6
    Join Date
    Jun 2010
    Posts
    15

    Default

    Im not sure how to do that...is there an example you can point to? Thanks a lot...

Posting Permissions

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