Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RepositoryItemReader setCurrentItemCount doesnt work. [BATCH-2274] #1331

Closed
spring-issuemaster opened this issue Jul 16, 2014 · 2 comments
Closed

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Jul 16, 2014

Jason opened BATCH-2274 and commented

if I configure a RepositoryItemReader and setCurrentItemCount,
it is never used. the flow in AbstractItemCountingItemStreamItemReader is such that any set currentItemCount will never affect the initial page.
the open method always runs before the update method, but the open method depends on the update method having run first for this function to work.
this can be worked around by overriding RepositoryItemReader and implementing the Open method setting executionContext.putInt(getExecutionContextKey(READ_COUNT), getCurrentItemCount());

but its far from ideal.
the doOpen method thats clearly intended for this kind of initialization in other cases doesn't pass the executionContext so cant be used here.


Affects: 3.0.1

Referenced from: commits 2ae6388, 1858e85

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 11, 2014

Michael Minella commented

Are you thinking that it would be ok for the first page to be "short"? In that if I had my page size set to 10, but currentItem was set to 5, the first commit would only process 5, then each page after that would be 10? Your suggested fix would cause that to occur but I wanted to confirm.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 28, 2014

Jason commented

absolutely. to me this is a more genuine resume than starting with a fresh 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.