Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-5071

Refactor org.jboss.as.jpa.transaction.TransactionUtil to not use static globals, use the JPAService singleton instead

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • Major
    • 10.0.0.CR1
    • None
    • JPA / Hibernate
    • None

    Description

      Perhaps something like the following in TransactionUtil:

         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);
          }
      

      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.

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            smarlow1@redhat.com Scott Marlow
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: