Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-15363

Drop DeferredQueryInvocationHandler.finalize()

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 4.3.7, 5.0 M5
    • Fix Version/s: 4.3.8, 5.0 RC1
    • Component/s: Data:ORM
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      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".

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              mmimica Milan Mimica
              Last updater:
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 45 weeks, 4 days ago