[jboss-jira] [JBoss JIRA] (WFLY-7367) add per PU cache of the new temp classloader returned from PersistenceUnitMetadataImpl.getNewTempClassLoader()
Scott Marlow (JIRA)
issues at jboss.org
Mon Oct 24 19:58:00 EDT 2016
[ https://issues.jboss.org/browse/WFLY-7367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13311128#comment-13311128 ]
Scott Marlow commented on WFLY-7367:
------------------------------------
Good point [~swd847], thanks for the feedback. I updated the description to reflect your suggestion. My local testing of [https://github.com/scottmarlow/wildfly/commit/e63a5ac75f2ca764dac9fda776e4e0077b2de305] was successful so far. If we keep this change, we should also have a persistence unit hint for disabling the caching.
An alternative might be for Hibernate ORM to do the caching of the getNewTempClassLoader() result, which might also help reduce permgen use for applications with a large number of entities.
> add per PU cache of the new temp classloader returned from PersistenceUnitMetadataImpl.getNewTempClassLoader()
> --------------------------------------------------------------------------------------------------------------
>
> Key: WFLY-7367
> URL: https://issues.jboss.org/browse/WFLY-7367
> Project: WildFly
> Issue Type: Enhancement
> Components: JPA / Hibernate
> Reporter: Scott Marlow
> Assignee: Scott Marlow
>
> The new temporary classloader returned by the WildFly PersistenceUnitInfo.getNewTempClassLoader() is currently created on every call.
> Ensure that the cached temp classloader reference is cleared after the PersistenceProvider.createContainerEntityManagerFactory() call returns.
> Javadoc description from [http://docs.oracle.com/javaee/7/api/javax/persistence/spi/PersistenceUnitInfo.html#getNewTempClassLoader--]
> {quote}
> ClassLoader getNewTempClassLoader()
> Return a new instance of a ClassLoader that the provider may use to temporarily load any classes, resources, or open URLs. The scope and classpath of this loader is exactly the same as that of the loader returned by getClassLoader(). None of the classes loaded by this class loader will be visible to application components. The provider may only use this ClassLoader within the scope of the PersistenceProvider.createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map) call.
> Returns:
> temporary ClassLoader with same visibility as current loader
> {quote}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list