[jboss-cvs] JBossAS SVN: r64789 - branches/JBoss_4_0_5_GA_JBAS-4574/naming/src/main/org/jnp/interfaces.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 22 16:47:43 EDT 2007
Author: bstansberry at jboss.com
Date: 2007-08-22 16:47:42 -0400 (Wed, 22 Aug 2007)
New Revision: 64789
Modified:
branches/JBoss_4_0_5_GA_JBAS-4574/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: branches/JBoss_4_0_5_GA_JBAS-4574/naming/src/main/org/jnp/interfaces/NamingContext.java
===================================================================
--- branches/JBoss_4_0_5_GA_JBAS-4574/naming/src/main/org/jnp/interfaces/NamingContext.java 2007-08-22 20:43:28 UTC (rev 64788)
+++ branches/JBoss_4_0_5_GA_JBAS-4574/naming/src/main/org/jnp/interfaces/NamingContext.java 2007-08-22 20:47:42 UTC (rev 64789)
@@ -218,6 +218,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;
}
}
@@ -364,19 +367,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
- }
}
/**
@@ -1498,7 +1499,7 @@
// Locate first available naming service
String urls = (String) refEnv.get(Context.PROVIDER_URL);
if (urls != null && urls.length() > 0)
- {
+ {
StringTokenizer tokenizer = new StringTokenizer(urls, ",");
while (naming == null && tokenizer.hasMoreElements())
@@ -1649,7 +1650,7 @@
if( log.isTraceEnabled() )
{
log.trace("Call failed with NoSuchObjectException, " +
- "flushing server cache and retrying", e);
+ "flushing server cache and reaquiring Naming ref", e);
}
naming = null;
removeServer(refEnv);
More information about the jboss-cvs-commits
mailing list