-
-
Notifications
You must be signed in to change notification settings - Fork 260
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
Weak reference based persistence context for streaming queries #2411
Conversation
FYI @rPraml |
Hello Rob, I took a look at this PR and combined it with the ideas here: #2407 (comment) and this is my result: https://github.com/FOCONIS/ebean/commits/feature/weak-reference-persistence-context here I removed the whole copy stuff that came with #2021 / #2028 - but the persistence context knows, when we are in a findEach loop. This change would also allow to pass beans out of a fineEach loop now Estimation of performance impact:
public Reference<? extends T> poll() {
if (head == null)
return null;
synchronized (lock) {
return reallyPoll();
}
} So if nothing is in queue (which is the case, unless we switch to reference mode) - this is just a simple null check.
So in my mind, this should not slow down anything in findList etc. - the foreach loop may be even be faster, because no copy from parent context needs to be done. |
@rbygrave please take a look at DLoadContext.resetPersistenceContext as it will not be called now As far as I see, the DLoadBean/ManyContext handles forEach internally. So this should be OK. Cheers |
…nce-context Change DefaultPersistenceContect to use beginIterate / endIterate
Thanks @rPraml , I think we have ended up with a good result here. |
The concept is to use this for streaming queries rather than periodically creating a new persistence context