Results 1 to 2 of 2

Thread: 'Uptdate' method of ItemStream and rollback

  1. #1
    Join Date
    Dec 2010
    Posts
    19

    Default 'Uptdate' method of ItemStream and rollback

    Hello,

    My Writer (FlatFileWriter) implements the 'update' and 'open' methods of the ItemStream class. I know that the update method is called after the writing of the chunk is fnished but NOT yet committed. So this gives us a guarantee that if saving of the state in the update method itself fails, our just written chunk will also be rolled-back. This seems to be working as I have tested it.

    Now what I am noticing is that if I have placed something in the ExecutionContext in the update method of ItemStream in the Writer class, that stuff or those values are not rolled back or discarded if there was in Exception in the update method. How I simulated this was that in the update method:

    Code:
    public void update(ExecutionContext ec)  throws ItemStreamException {
       //...Do stuff
       ec.putLong("restart_value", 1);
       //...Do stuff
       throw new RuntimeException("dummy");
       
       super.update(ec);//What if exception occurs within this?
    }
    Now when the exception is thrown then my last written chunk is successfully rolled back but on the restart I get the value 1 for "restart_value" attribute. Shouldn't this be discard as well? Or I have to roll back or clear the Execution Context myself?

    What is exception occurs within super.update where I do not have any control? Please advise. Thanks.

  2. #2
    Join Date
    Dec 2010
    Posts
    19

Tags for this Thread

Posting Permissions

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