[jboss-jira] [JBoss JIRA] (WFLY-5071) Refactor org.jboss.as.jpa.transaction.TransactionUtil to not use static globals, use the JPAService singleton instead

Scott Marlow (JIRA) issues at jboss.org
Thu Sep 3 11:02:00 EDT 2015


     [ https://issues.jboss.org/browse/WFLY-5071?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Marlow reassigned WFLY-5071:
----------------------------------

    Assignee: Stuart Douglas  (was: Scott Marlow)


> Refactor org.jboss.as.jpa.transaction.TransactionUtil to not use static globals, use the JPAService singleton instead
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: WFLY-5071
>                 URL: https://issues.jboss.org/browse/WFLY-5071
>             Project: WildFly
>          Issue Type: Task
>          Components: JPA / Hibernate
>            Reporter: Scott Marlow
>            Assignee: Stuart Douglas
>             Fix For: 10.0.0.CR1
>
>
> Perhaps something like the following in TransactionUtil:
> {code}
>    public static TransactionManager getTransactionManager() {
>      JPAService jpaService = 
> currentServiceContainer().getService(org.jboss.as.jpa.service.JPAService.SERVICE_NAME);
>    return jpaService.getTransactionManager();
>    }
>     private static ServiceContainer currentServiceContainer() {
>         if(System.getSecurityManager() == null) {
>             return CurrentServiceContainer.getServiceContainer();
>         }
>         return AccessController.doPrivileged(CurrentServiceContainer.GET_ACTION);
>     }
> {code}
> Might want to refactor the callers into TransactionUtil to cache the JPAService, so we don't have to look it up several times per entity manager invocation.  Otherwise, the service lookup may be done too many times.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list