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

Closed
spring-issuemaster opened this issue Mar 20, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

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:

  • #16077 EntityManager should explicitly get closed for non-executed Query objects

Referenced from: commits c31bfe6, b2a6a57

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

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
You can’t perform that action at this time.