ExecutionContext isn't saved completely
I have a reader which extends another reader. Both shall persist their state in the execution context to make them restartable.
The superclass reader is able to read multiple items at once and return them one-by-one to fulfill the contract of the read()-method. This is his update()-method:
Code:
executionContext.put(BUFFERED_ITEMS_KEY, this.items);
System.out.println("Update Buffered_Items: " + this.items);
The inheriting reader has a cursor and counts the number of items which it already requested. He does the following in the update()-method:
Code:
executionContext.putInt(START_FROM_KEY, this.currentStartFrom);
System.out.println("Update Start_From: " + this.currentStartFrom);
super.update(executionContext);
So whenever update is called the curser ("start from") and the buffered items are stored in the context. I can see this in the console output too.
In my test case when I cause the job to reach its skip-limit and to abort, I only find the correct cursor position in the database but the item list is empty. How can that be?
Quote:
{"map":{"entry":[{"string":"FlatFileItemWriter.written","long":20}, {"string":"FlatFileItemWriter.current.count","long ":70},{"string":"Start_From","int":24},{"string":"Buffered_Items_fioefieiidsfie","linked-list":""}]}}
When I watched the database content during debugging, the state was correctly saved before the abortion.