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

Drop DeferredQueryInvocationHandler.finalize() [SPR-15363] #19927

spring-projects-issues opened this issue Mar 20, 2017 · 1 comment
in: data Issues in data modules (jdbc, orm, oxm, tx) type: task A general task


Copy link

spring-projects-issues commented Mar 20, 2017

Milan Mimica opened SPR-15363 and commented

Remove org.springframework.orm.jpa.SharedEntityManagerCreator.DeferredQueryInvocationHandler.finalize()

Object.finalize() is being deprecated in Java 9 and bound to be removed in later versions.

And, what I find more important, it creates significant performance issues. When the class implements finalize() the Hotspot VM internally calls java.lang.ref.Finalizer#add() from Object's constructor, and there is a synchronized block in it. Spring-data-jpa creates lots of DeferredQueryInvocationHandler objects.

Consider using Java 9 Cleaner API. But if I understand correctly, the finalize() is there only "for open/close statistics to be in sync".

Affects: 4.3.7, 5.0 M5

Issue Links:

Referenced from: commits c31bfe6, b2a6a57

Copy link
Collaborator Author

spring-projects-issues commented Mar 21, 2017

Christoph Dreis commented

+1 for this. If possible a backport to 4.x is highly appreciated :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: data Issues in data modules (jdbc, orm, oxm, tx) type: task A general task
None yet

No branches or pull requests

2 participants