[jboss-jira] [JBoss JIRA] Created: (JBAS-5906) Client user transaction lookups aren't closing initial contexts

Adrian Brock (JIRA) jira-events at lists.jboss.org
Fri Aug 29 09:53:39 EDT 2008


Client user transaction lookups aren't closing initial contexts
---------------------------------------------------------------

                 Key: JBAS-5906
                 URL: https://jira.jboss.org/jira/browse/JBAS-5906
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Transaction Manager (JBossTM)
    Affects Versions: JBossAS-4.2.3.GA, JBossAS-5.0.0.CR1
            Reporter: Adrian Brock
            Assignee: Galder Zamarreno
             Fix For: JBossAS-5.0.0.CR2, JBossAS-4.2.4.GA


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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list