Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-5908

ClientUserTransactionObjectFactory is inefficient

XMLWordPrintable

      The ClientUserTransactionObjectFactory is inefficient.

      1) It is doing initialisation based on a static cached instance
      Since nothing holds a hard reference to this class, it can be garbage collected meaning the
      initialisation can be done multiple times.

      2) The determination and resolving of the ServerVMClientUserTransaction does the lookup
      for the transaction twice. Once when initialising the singleton and again to see whether it should
      use the singleton.

      Both issues could be resolved by simplifying ClientUserTransactionObjectFactory.getUserTransaction()
      to be something (which removes the need for the cached object)

      static private UserTransaction getUserTransaction()

      { ServerVMClientUserTransaction serverUserTransaction = ServerVMClientUserTransaction.getSingleton(); if (serverUserTranasction.isServer()) return serverUserTransaction; else return ClientUserTransaction.getSingleton(); }

      This would require a new method on ServerVMClientUserTransaction to detect whether it can be used,
      i.e. it can locate a local transaction manager.

      public boolean isServer()
      {
      return tm != null;
      }

              rh-ee-galder Galder ZamarreƱo
              adrian.brock Adrian Brock (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: