[jboss-cvs] JBossAS SVN: r64664 - 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
Fri Aug 17 15:06:20 EDT 2007
Author: bstansberry at jboss.com
Date: 2007-08-17 15:06:19 -0400 (Fri, 17 Aug 2007)
New Revision: 64664
Modified:
branches/JBoss_4_0_5_GA_JBAS-4574/naming/src/main/org/jnp/interfaces/NamingContext.java
Log:
[JBAS-4574] Don't include JBAS-4574 failures in lookup retry calc; doc for the JNP_MAX_RETRIES attribute says its only for ConnectException
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-17 19:01:47 UTC (rev 64663)
+++ branches/JBoss_4_0_5_GA_JBAS-4574/naming/src/main/org/jnp/interfaces/NamingContext.java 2007-08-17 19:06:19 UTC (rev 64664)
@@ -34,6 +34,8 @@
import java.net.InetSocketAddress;
import java.rmi.ConnectException;
import java.rmi.MarshalledObject;
+import java.rmi.NoSuchObjectException;
+import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -620,35 +622,38 @@
boolean trace = log.isTraceEnabled();
for (int i = 0; i < maxTries; i++)
{
- if( trace )
- log.trace("Retyring , retry count: "+i);
try
{
- res = naming.lookup(n);
- break;
- }
- // This is the case when the server has been restarted
- // while the stub hasn't been dgc-ed yet.
- // We will simply flush out the server from cache
- // and do another try. BW.
- catch (java.rmi.NoSuchObjectException nsoe)
- {
- // Even if maxTries is 1, we will still retry it here.
- int retries = maxTries - i;
- if( trace )
- log.trace("Connect failed with NoSuchObjectException, retry count: "+retries, nsoe);
- // let's flush the bad server first.
- if (retries > 0)
+ try
{
- removeServer(refEnv);
- naming = null;
- checkRef(refEnv);
-
- res = naming.lookup(n);
- break;
+ res = naming.lookup(n);
}
- // Still can't resolve the exception. Throw the exception to flush the bad server
- throw nsoe;
+ catch (RemoteException re)
+ {
+ // JBAS-4574. Check for the case when the server has been restarted
+ // while the cached naming stub hasn't been dgc-ed yet.
+ // We will simply flush out the server from cache
+ // and do another try. BW.
+ if (re instanceof NoSuchObjectException
+ || re.getCause() instanceof NoSuchObjectException)
+ {
+ if( trace )
+ log.trace("Call failed with NoSuchObjectException, " +
+ "flushing server cache and retrying", re);
+ naming = null;
+ removeServer(refEnv);
+
+ checkRef(refEnv);
+ res = naming.lookup(n);
+ }
+ else
+ {
+ // Not JBAS-4574. Throw it on and let outer logic handle it.
+ throw re;
+ }
+ }
+ // If we got here, we succeeded, so break the loop
+ break;
}
catch (ConnectException ce)
{
@@ -670,28 +675,6 @@
// Throw the exception to flush the bad server
throw ce;
}
- catch (java.rmi.RemoteException ioe)
- {
- if(ioe.getCause() instanceof java.rmi.NoSuchObjectException)
- {
- // Even if maxTries is 1, we will still retry it here.
- int retries = maxTries - i;
- if( trace )
- log.trace("Connect failed with NoSuchObjectException, retry count: "+retries, ioe.getCause());
- // let's flush the bad server first.
- if (retries > 0)
- {
- removeServer(refEnv);
- naming = null;
- checkRef(refEnv);
-
- res = naming.lookup(n);
- break;
- }
- // Still can't resolve the exception. Throw the exception to flush the bad server
- throw ioe;
- }
- }
}
if (res instanceof MarshalledValuePair)
{
More information about the jboss-cvs-commits
mailing list