[jboss-cvs] JBossAS SVN: r64808 - trunk/naming/src/main/org/jnp/interfaces.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 23 13:14:42 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-08-23 13:14:41 -0400 (Thu, 23 Aug 2007)
New Revision: 64808

Modified:
   trunk/naming/src/main/org/jnp/interfaces/NamingContext.java
Log:
[JBAS-4622] Use the "hostKey" env property to remove stale naming stubs when no java.naming.provider.url is provided

Modified: trunk/naming/src/main/org/jnp/interfaces/NamingContext.java
===================================================================
--- trunk/naming/src/main/org/jnp/interfaces/NamingContext.java	2007-08-23 17:13:58 UTC (rev 64807)
+++ trunk/naming/src/main/org/jnp/interfaces/NamingContext.java	2007-08-23 17:14:41 UTC (rev 64808)
@@ -220,6 +220,9 @@
          server = (Naming) ref.get();
          if (server != null)
          {
+            // JBAS-4622. Ensure the env for the request has the
+            // hostKey so we can remove the cache entry if there is a failure
+            serverEnv.put("hostKey", hostKey);
             return server;
          }
       }
@@ -366,19 +369,17 @@
             {
             }
          }
-         Object hostKey = serverEnv.remove("hostKey");
-         if (hostKey != null)
+      }
+      
+      // JBAS-4622. Always do this.
+      Object hostKey = serverEnv.remove("hostKey");
+      if (hostKey != null)
+      {
+         synchronized (NamingContext.class)
          {
-            synchronized (NamingContext.class)
-            {
-               cachedServers.remove(hostKey);
-            }
+            cachedServers.remove(hostKey);
          }
       }
-      else
-      {
-         // Don't do anything for local server
-      }
    }
 
    /**




More information about the jboss-cvs-commits mailing list