Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-3734

HibernateAnnotationScanner keeps references to application's ClassLoader

    Details

    • Similar Issues:
      Show 10 results 

      Description

      Well, this is a minor issue as the references are kept in WeakHashMaps. Indeed, the HibernateAnnotationScanner contains static weak maps of the Package/Classes of the current application. They are indexed by PersistenceUnitMetadata.

      When the application gets undeployed the PersistenceUnitMetadata is no longer referenced, and should be garbage collected. However the value of the WeahHashMap won't be removed until the next expunging is done. As the application has been undeployed, it does not really make sense to keep strong references to the classes or packages. So, using Set<WeakReference<Package>> and Set<WeakReference<Class<?>>> would improve garbage collecting of the application's class loader and make more PermGen easily available.

        Gliffy Diagrams

          Activity

          guinotphil Philippe Guinot created issue -
          guinotphil Philippe Guinot made changes -
          Field Original Value New Value
          Forum Reference https://community.jboss.org/thread/195134
          Hide
          smarlow Scott Marlow added a comment -

          Hmm, the CLASSES_IN_JAR_CACHE storage is cleaned up at application undeploy time and that seems to work well. Perhaps we should forget about using WeakHashMap for PACKAGES_IN_JAR_CACHE and instead clean up each PersistenceUnitMetadata (key class) when the application is undeployed.

          Show
          smarlow Scott Marlow added a comment - Hmm, the CLASSES_IN_JAR_CACHE storage is cleaned up at application undeploy time and that seems to work well. Perhaps we should forget about using WeakHashMap for PACKAGES_IN_JAR_CACHE and instead clean up each PersistenceUnitMetadata (key class) when the application is undeployed.
          Hide
          smarlow Scott Marlow added a comment -

          Stepping through the cleanup code, while running unit test org.jboss.as.test.integration.jpa.dsrestart.JpaDsRestartTestCase, looks good (both collections get cleaned up correctly with the above mentioned change).

          Show
          smarlow Scott Marlow added a comment - Stepping through the cleanup code, while running unit test org.jboss.as.test.integration.jpa.dsrestart.JpaDsRestartTestCase, looks good (both collections get cleaned up correctly with the above mentioned change).
          smarlow Scott Marlow made changes -
          Status Open [ 1 ] Pull Request Sent [ 10011 ]
          Git Pull Request https://github.com/jbossas/jboss-as/pull/1506
          smarlow Scott Marlow made changes -
          Status Pull Request Sent [ 10011 ] Closed [ 6 ]
          Resolution Done [ 1 ]

            People

            • Assignee:
              smarlow Scott Marlow
              Reporter:
              guinotphil Philippe Guinot
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development