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

Client user transaction lookups aren't closing initial contexts

XMLWordPrintable

      There are a number of places in the UserTransaction initialisation and TxPropogationContextUtil
      that are doing jndi lookups() without closing the initial context.

      Typically

      new InitialContext().lookup(...);

      This is inefficient since on the client side this will mean an rmi connection is open
      until it gets garbage collected.

      This has already been fixed in JBoss5 for the TxPropogationContextUtil (correct code should look like this)

      try
      {
      InitialContext ctx = new InitialContext();
      try

      { tpcFactory = (TransactionPropagationContextFactory) ctx.lookup(EXPORTER_JNDI_NAME); }

      finally

      { ctx.close(); }

      }
      catch (NamingException e)

      { throw new RuntimeException("Unable to lookup " + EXPORTER_JNDI_NAME, e); }

              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: