[jboss-cvs] JBossAS SVN: r77847 - branches/Branch_4_2/server/src/main/org/jboss/proxy/ejb.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 3 10:34:51 EDT 2008


Author: galder.zamarreno at jboss.com
Date: 2008-09-03 10:34:51 -0400 (Wed, 03 Sep 2008)
New Revision: 77847

Modified:
   branches/Branch_4_2/server/src/main/org/jboss/proxy/ejb/RetryInterceptor.java
Log:
[JBAS-5906] Clean up our NamingContext

Modified: branches/Branch_4_2/server/src/main/org/jboss/proxy/ejb/RetryInterceptor.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/proxy/ejb/RetryInterceptor.java	2008-09-03 14:33:01 UTC (rev 77846)
+++ branches/Branch_4_2/server/src/main/org/jboss/proxy/ejb/RetryInterceptor.java	2008-09-03 14:34:51 UTC (rev 77847)
@@ -27,6 +27,7 @@
 import java.util.Hashtable;
 import java.util.Properties;
 import javax.naming.InitialContext;
+import javax.naming.NamingException;
 
 import org.jboss.invocation.Invocation;
 import org.jboss.invocation.InvocationContext;
@@ -238,10 +239,11 @@
       Invoker newInvoker = null;
       while( retry == true )
       {
+         InitialContext namingCtx = null;
          try
          {
             Thread.sleep(sleepTime);
-            InitialContext namingCtx = new InitialContext(retryProps);
+            namingCtx = new InitialContext(retryProps);
             if( trace )
                log.trace("Looking for invoker: "+jndiName);
             newInvoker = (Invoker) namingCtx.lookup(jndiName);
@@ -263,6 +265,22 @@
                break;
             }
          }
+         finally
+         {
+            // JBAS-5906 -- clean up after ourselves
+            if (namingCtx != null)
+            {
+               try
+               {
+                  namingCtx.close();
+               }
+               catch (NamingException e)
+               {
+                  log.warn("Problem closing naming context used for reaquiring invoker: " + 
+                        e.getClass() + " -- " + e.getLocalizedMessage());
+               }
+            }
+         }         
       }
       if( trace )
          log.trace("End reestablishInvokerProxy");




More information about the jboss-cvs-commits mailing list