Uploaded image for project: 'Spring Batch'
  1. Spring Batch
  2. BATCH-1942

Storage of a LinkedList in ExecutionContext doesn't persist after a Job failed


    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.0.4
    • Fix Version/s: None
    • Component/s: Core
    • Labels:


      In the reader's update()-method I wanted to store a LinkedList of Longs (my items) in the executionContext. So when the job would restart the open()-method could read them from there and continue with these items.

      I wrote myself a JUnit test and simulated exceptions for certain calls to reader until the skip limit was reached to make the job fail. Before the job failed (I paused the execution in debugging mode) I could see that my LinkedList got persisted in the database. But when I continued and let the job fail, the LinkedList in the database's execution context was empty!

      Even after long debugging I couldn't find the coe which caused this. Furthermore I also stored some other context information as primitive integer and this worked fine!
      The final workaround was to avoid the serialisation of the LinkedList and convert the List to a String by myself. Putting the String in the ExecutionContext worked fine.




            • Assignee:
              mminella Michael Minella
              peter.wippermann Peter Wippermann
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: