[jboss-cvs] JBossAS SVN: r69749 - in trunk: testsuite/src/main/org/jboss/test/naming/test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 8 22:58:18 EST 2008
Author: bstansberry at jboss.com
Date: 2008-02-08 22:58:18 -0500 (Fri, 08 Feb 2008)
New Revision: 69749
Modified:
trunk/naming/src/main/org/jnp/interfaces/NamingContext.java
trunk/testsuite/src/main/org/jboss/test/naming/test/NamingRestartUnitTestCase.java
Log:
[JBAS-4616] NamingContext lookupLink() now acquires stub to server Naming service
Fix some comments in NamingContext
Modified: trunk/naming/src/main/org/jnp/interfaces/NamingContext.java
===================================================================
--- trunk/naming/src/main/org/jnp/interfaces/NamingContext.java 2008-02-09 03:15:57 UTC (rev 69748)
+++ trunk/naming/src/main/org/jnp/interfaces/NamingContext.java 2008-02-09 03:58:18 UTC (rev 69749)
@@ -1,24 +1,24 @@
/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jnp.interfaces;
import java.io.BufferedInputStream;
@@ -519,7 +519,7 @@
}
catch (RemoteException re)
{
- // Check for JBAS-4574.
+ // Check for JBAS-4615.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
@@ -527,7 +527,7 @@
}
else
{
- // Not JBAS-4574. Throw exception and let outer logic handle it.
+ // Not JBAS-4615. Throw exception and let outer logic handle it.
throw re;
}
}
@@ -594,7 +594,7 @@
}
catch (RemoteException re)
{
- // Check for JBAS-4574.
+ // Check for JBAS-4615.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
@@ -602,7 +602,7 @@
}
else
{
- // Not JBAS-4574. Throw exception and let outer logic handle it.
+ // Not JBAS-4615. Throw exception and let outer logic handle it.
throw re;
}
}
@@ -670,7 +670,7 @@
}
catch (RemoteException re)
{
- // Check for JBAS-4574.
+ // Check for JBAS-4615.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
@@ -678,7 +678,7 @@
}
else
{
- // Not JBAS-4574. Throw exception and let outer logic handle it.
+ // Not JBAS-4615. Throw exception and let outer logic handle it.
throw re;
}
}
@@ -815,7 +815,7 @@
}
catch (RemoteException re)
{
- // Check for JBAS-4574.
+ // Check for JBAS-4615.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
@@ -823,7 +823,7 @@
}
else
{
- // Not JBAS-4574. Throw exception and let outer logic handle it.
+ // Not JBAS-4615. Throw exception and let outer logic handle it.
throw re;
}
}
@@ -881,7 +881,7 @@
}
catch (RemoteException re)
{
- // Check for JBAS-4574.
+ // Check for JBAS-4615.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
@@ -889,7 +889,7 @@
}
else
{
- // Not JBAS-4574. Throw exception and let outer logic handle it.
+ // Not JBAS-4615. Throw exception and let outer logic handle it.
throw re;
}
}
@@ -937,7 +937,7 @@
}
catch (RemoteException re)
{
- // Check for JBAS-4574.
+ // Check for JBAS-4615.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
@@ -945,7 +945,7 @@
}
else
{
- // Not JBAS-4574. Throw exception and let outer logic handle it.
+ // Not JBAS-4615. Throw exception and let outer logic handle it.
throw re;
}
}
@@ -1060,7 +1060,7 @@
}
catch (RemoteException re)
{
- // Check for JBAS-4574.
+ // Check for JBAS-4615.
if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
@@ -1068,7 +1068,7 @@
}
else
{
- // Not JBAS-4574. Throw exception and let outer logic handle it.
+ // Not JBAS-4615. Throw exception and let outer logic handle it.
throw re;
}
}
@@ -1154,10 +1154,15 @@
public Object lookupLink(Name name)
throws NamingException
{
- // FIXME JBAS-4616
+ Hashtable refEnv = getEnv(name);
+ checkRef(refEnv);
+ Name unparsedName = name;
+ Name parsedName = (Name) refEnv.get(JNP_PARSED_NAME);
+ if (parsedName != null)
+ name = parsedName;
if (name.isEmpty())
- return lookup(name);
+ return lookup(unparsedName);
Object link = null;
try
@@ -1169,16 +1174,15 @@
}
catch (RemoteException re)
{
- // Check for JBAS-4574.
- // TODO if we resolve JBAS-4616, need to use refEnv
- if (handleStaleNamingStub(re, env))
+ // Check for JBAS-4615.
+ if (handleStaleNamingStub(re, refEnv))
{
// try again with new naming stub
link = naming.lookup(n);
}
else
{
- // Not JBAS-4574. Throw exception and let outer logic handle it.
+ // Not JBAS-4615. Throw exception and let outer logic handle it.
throw re;
}
}
@@ -1189,7 +1193,7 @@
catch (IOException e)
{
naming = null;
- removeServer(env);
+ removeServer(refEnv);
NamingException ex = new CommunicationException();
ex.setRootCause(e);
throw ex;
@@ -1667,7 +1671,7 @@
}
/**
- * JBAS-4574. Check if the given exception is because the server has
+ * JBAS-4615. Check if the given exception is because the server has
* been restarted while the cached naming stub hasn't been dgc-ed yet.
* If yes, we will flush out the naming stub from our cache and
* acquire a new stub. BW.
@@ -1688,8 +1692,8 @@
{
if( log.isTraceEnabled() )
{
- log.trace("Call failed with NoSuchObjectException, " +
- "flushing server cache and retrying", e);
+ log.trace("Call failed with recoverable RMI failure, " +
+ "flushing server cache and reaquiring Naming ref", e);
}
naming = null;
removeServer(refEnv);
Modified: trunk/testsuite/src/main/org/jboss/test/naming/test/NamingRestartUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/naming/test/NamingRestartUnitTestCase.java 2008-02-09 03:15:57 UTC (rev 69748)
+++ trunk/testsuite/src/main/org/jboss/test/naming/test/NamingRestartUnitTestCase.java 2008-02-09 03:58:18 UTC (rev 69749)
@@ -313,15 +313,8 @@
}
catch (NamingException e)
{
- if (e.getCause() instanceof NullPointerException)
- {
- log.error("Caught known failure JBAS-4616", e);
- }
- else
- {
- log.error("Caught NamingException", e);
- fail(e.getMessage());
- }
+ log.error("Caught NamingException", e);
+ fail(e.getMessage());
}
// Confirm the original context is still good
@@ -435,8 +428,8 @@
{
String namingURL = getServerHost() + ":" + port;
Properties env = new Properties();
- env.setProperty("java.naming.provider.url", namingURL);
- env.setProperty("jnp.disableDiscovery", "true");
+ env.setProperty(Context.PROVIDER_URL, namingURL);
+ env.setProperty(NamingContext.JNP_DISABLE_DISCOVERY, "true");
return env;
}
More information about the jboss-cvs-commits
mailing list