[jboss-jira] [JBoss JIRA] (WFLY-441) If possible, eliminate the NonTxEmCloser by closing the EM immediately after each EM invocation

Scott Marlow (JIRA) issues at jboss.org
Mon Apr 14 09:28:33 EDT 2014


    [ https://issues.jboss.org/browse/WFLY-441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12961619#comment-12961619 ] 

Scott Marlow commented on WFLY-441:
-----------------------------------

At one point, we created this issue because of the "theoretical" performance concerns of installing a web container valve.  However, I have yet to hear of any actual performance monitoring results backing the theory up.  Keeping the NoneTXEmCloser, should help performance when there isn't an active JTA transaction.  

One way to address this might be introducing an entity manager cache per persistence unit.
                
> If possible, eliminate the NonTxEmCloser by closing the EM immediately after each EM invocation
> -----------------------------------------------------------------------------------------------
>
>                 Key: WFLY-441
>                 URL: https://issues.jboss.org/browse/WFLY-441
>             Project: WildFly
>          Issue Type: Task
>      Security Level: Public(Everyone can see) 
>          Components: JPA / Hibernate
>            Reporter: Scott Marlow
>            Priority: Minor
>             Fix For: 8.1.0.CR1
>
>
> For Queries, handoff the EntityManager to a Query object wrapper and have the Query object finalizer close the EntityManager.  
> Make sure that we respect JPA 2.0 section 3.8.6 (detach objects returned from Query object).
> 1.  Methods that return a Query, will hand off the EM to the Query object wrapper.
> 2.  Other methods will close the EM at the end of the EM method invocation.
> When making this change, make sure that performance doesn't degrade.  The cost of this change, will be that each (transaction scoped non-tx) EM invocation will create a new persistence context, but we can eliminate the NonTxEmCloser which has its own overhead.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list