Committed objects are getting reverted to previous values because of a commit of a different object

Hi, I have a list of entities whose data is sent to a Java action(parseFileJ), parse them and return them in a custom format. The parsed objects are flagged and committed. This action is performed 2 list items at a time to avoid Java heap space to run out. The data in some of the entities is so large that it takes 6 hrs to parse the data and return the format. The problem I’m facing is that, after a couple of iterations, when such a large entity is encountered, all the entities in current list are parsed perfectly, but when those are committed, all the previous list items commits in previous iterations are being reverted(flag is reset) and the process starts from the beginning again making it as an infinite loop.  This is happening every time and I don’t see any memory issue in the logs either.  The process works perfectly when those big entities are removed.  I’m not sure what is happening here. Can anyone explain what the issue is here?   Thanks in advance.    
0 answers