[jboss-cvs] JBossAS SVN: r64876 - in branches/JBoss_4_0_5_GA_CP06_JBAS-4631: naming/src/main/org/jnp/interfaces and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Aug 25 02:39:47 EDT 2007


Author: jiwils
Date: 2007-08-25 02:39:46 -0400 (Sat, 25 Aug 2007)
New Revision: 64876

Added:
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/NonDeserializable.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinderMBean.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartHANamingService.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingService.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingServiceMBean.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/test/NamingRestartUnitTestCase.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/resources/naming/restart/
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/resources/naming/restart/jboss-service.xml
Removed:
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/NonDeserializable.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinderMBean.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartHANamingService.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingService.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingServiceMBean.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/resources/naming/restart/jboss-service.xml
Modified:
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/cluster/src/main/org/jboss/ha/framework/interfaces/HARMIClient.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/naming/src/main/org/jnp/interfaces/NamingContext.java
   branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/imports/sections/naming.xml
Log:
Merged /tags/JBoss_4_0_5_GA and /branches/JBoss_4_0_5_GA_JBAS-4574 in to the branch for [JBAS-4631].

Modified: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/cluster/src/main/org/jboss/ha/framework/interfaces/HARMIClient.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP06_JBAS-4631/cluster/src/main/org/jboss/ha/framework/interfaces/HARMIClient.java	2007-08-25 06:18:52 UTC (rev 64875)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/cluster/src/main/org/jboss/ha/framework/interfaces/HARMIClient.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -158,9 +158,9 @@
    {
       boolean trace = log.isTraceEnabled();
       HARMIServer target = (HARMIServer)getRemoteTarget();
+      Exception lastException = null;
       while (target != null)
-      {
-         Exception lastException = null;
+      {         
          try
          {
             if( trace )
@@ -210,7 +210,7 @@
          target = (HARMIServer)getRemoteTarget();
       }
       // if we get here this means list was exhausted
-      throw new java.rmi.RemoteException("Service unavailable.");
+      throw new java.rmi.RemoteException("Service unavailable.", lastException);
 
    }
 

Modified: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/naming/src/main/org/jnp/interfaces/NamingContext.java
===================================================================
--- branches/JBoss_4_0_5_GA_CP06_JBAS-4631/naming/src/main/org/jnp/interfaces/NamingContext.java	2007-08-25 06:18:52 UTC (rev 64875)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/naming/src/main/org/jnp/interfaces/NamingContext.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -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;
@@ -216,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;
          }
       }
@@ -362,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
-      }
    }
 
    /**
@@ -507,7 +510,24 @@
          {
             className = ((Reference) obj).getClassName();
          }
-         naming.rebind(getAbsoluteName(name), obj, className);
+         try
+         {
+            naming.rebind(getAbsoluteName(name), obj, className);
+         }
+         catch (RemoteException re)
+         {
+            // Check for JBAS-4574.
+            if (handleStaleNamingStub(re, refEnv))
+            {
+               // try again with new naming stub                  
+               naming.rebind(getAbsoluteName(name), obj, className);
+            }
+            else
+            {
+               // Not JBAS-4574. Throw exception and let outer logic handle it.
+               throw re;
+            }            
+         }
       }
       catch (CannotProceedException cpe)
       {
@@ -563,7 +583,25 @@
             className = ((Reference) obj).getClassName();
          }
          name = getAbsoluteName(name);
-         naming.bind(name, obj, className);
+         
+         try
+         {
+            naming.bind(name, obj, className);
+         }
+         catch (RemoteException re)
+         {
+            // Check for JBAS-4574.
+            if (handleStaleNamingStub(re, refEnv))
+            {
+               // try again with new naming stub                  
+               naming.bind(name, obj, className);
+            }
+            else
+            {
+               // Not JBAS-4574. Throw exception and let outer logic handle it.
+               throw re;
+            }            
+         }
       }
       catch (CannotProceedException cpe)
       {
@@ -622,7 +660,25 @@
          {
             try
             {
-               res = naming.lookup(n);
+               try
+               {
+                  res = naming.lookup(n);
+               }
+               catch (RemoteException re)
+               {
+                  // Check for JBAS-4574.
+                  if (handleStaleNamingStub(re, refEnv))
+                  {
+                     // try again with new naming stub                  
+                     res = naming.lookup(n);
+                  }
+                  else
+                  {
+                     // Not JBAS-4574. Throw exception and let outer logic handle it.
+                     throw re;
+                  }
+               }
+               // If we got here, we succeeded, so break the loop
                break;
             }
             catch (ConnectException ce)
@@ -749,7 +805,24 @@
 
       try
       {
-         naming.unbind(getAbsoluteName(name));
+         try
+         {
+            naming.unbind(getAbsoluteName(name));
+         }
+         catch (RemoteException re)
+         {
+            // Check for JBAS-4574.
+            if (handleStaleNamingStub(re, refEnv))
+            {
+               // try again with new naming stub                  
+               naming.unbind(getAbsoluteName(name));
+            }
+            else
+            {
+               // Not JBAS-4574. Throw exception and let outer logic handle it.
+               throw re;
+            }             
+         }
       }
       catch (CannotProceedException cpe)
       {
@@ -797,7 +870,26 @@
 
       try
       {
-         return new NamingEnumerationImpl(naming.list(getAbsoluteName(name)));
+         Collection c = null;
+         try
+         {
+            c = naming.list(getAbsoluteName(name));
+         }
+         catch (RemoteException re)
+         {
+            // Check for JBAS-4574.
+            if (handleStaleNamingStub(re, refEnv))
+            {
+               // try again with new naming stub                  
+               c = naming.list(getAbsoluteName(name));
+            }
+            else
+            {
+               // Not JBAS-4574. Throw exception and let outer logic handle it.
+               throw re;
+            }            
+         }
+         return new NamingEnumerationImpl(c);
       }
       catch (CannotProceedException cpe)
       {
@@ -833,7 +925,26 @@
       try
       {
          // Get list
-         Collection bindings = naming.listBindings(getAbsoluteName(name));
+         Collection bindings = null;
+         try
+         {
+            // Get list
+            bindings = naming.listBindings(getAbsoluteName(name));
+         }
+         catch (RemoteException re)
+         {
+            // Check for JBAS-4574.
+            if (handleStaleNamingStub(re, refEnv))
+            {
+               // try again with new naming stub                  
+               bindings = naming.listBindings(getAbsoluteName(name));
+            }
+            else
+            {
+               // Not JBAS-4574. Throw exception and let outer logic handle it.
+               throw re;
+            }            
+         }
          Collection realBindings = new ArrayList(bindings.size());
          
          // Convert marshalled objects
@@ -939,7 +1050,24 @@
       try
       {
          name = getAbsoluteName(name);
-         return naming.createSubcontext(name);
+         try
+         {
+            return naming.createSubcontext(name);
+         }
+         catch (RemoteException re)
+         {
+            // Check for JBAS-4574.
+            if (handleStaleNamingStub(re, refEnv))
+            {
+               // try again with new naming stub                  
+               return naming.createSubcontext(name);
+            }
+            else
+            {
+               // Not JBAS-4574. Throw exception and let outer logic handle it.
+               throw re;
+            }            
+         }
       }
       catch (CannotProceedException cpe)
       {
@@ -1017,14 +1145,34 @@
    public Object lookupLink(Name name)
       throws NamingException
    {
+      // FIXME JBAS-4616      
+      
       if (name.isEmpty())
          return lookup(name);
-
+      
       Object link = null;
       try
       {
          Name n = getAbsoluteName(name);
-         link = naming.lookup(n);
+         try
+         {
+            link = naming.lookup(n);
+         }
+         catch (RemoteException re)
+         {
+            // Check for JBAS-4574.
+            // TODO if we resolve JBAS-4616, need to use refEnv
+            if (handleStaleNamingStub(re, env))
+            {
+               // try again with new naming stub                  
+               link = naming.lookup(n);
+            }
+            else
+            {
+               // Not JBAS-4574. Throw exception and let outer logic handle it.
+               throw re;
+            }            
+         }
          if (!(link instanceof LinkRef) && link instanceof Reference)
             link = getObjectInstance(link, name, null);
          ;
@@ -1351,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())
@@ -1478,6 +1626,50 @@
       }
       return nameEnv;
    }
+   
+   /**
+    * JBAS-4574. 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.
+    * 
+    * @param e  the exception that may be due to a stale stub
+    * @param refEnv the naming environment associated with the failed call
+    * 
+    * @return <code>true</code> if <code>e</code> indicates a stale
+    *         naming stub and we were able to succesfully flush the
+    *         cache and acquire a new stub; <code>false</code> otherwise.
+    */
+   private boolean handleStaleNamingStub(Exception e, Hashtable refEnv)
+   {
+      if (e instanceof NoSuchObjectException
+            || e.getCause() instanceof NoSuchObjectException)
+      {
+         try
+         {
+            if( log.isTraceEnabled() )
+            {
+               log.trace("Call failed with NoSuchObjectException, " +
+                         "flushing server cache and reaquiring Naming ref", e);
+            }
+            naming = null;
+            removeServer(refEnv);
+              
+            checkRef(refEnv);
+            
+            return true;
+         }
+         catch (Exception e1)
+         {
+            // Just log and return false; let caller continue processing
+            // the original exception passed in to this method
+            log.error("Caught exception flushing server cache and " +
+                      "re-establish naming after exception " + 
+                      e.getLocalizedMessage(), e1);
+         }
+      }
+      return false;
+   }
 
    // Inner classes -------------------------------------------------
 }

Modified: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/imports/sections/naming.xml
===================================================================
--- branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/imports/sections/naming.xml	2007-08-25 06:18:52 UTC (rev 64875)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/imports/sections/naming.xml	2007-08-25 06:39:46 UTC (rev 64876)
@@ -3,7 +3,7 @@
    <target name="_jars-naming">
       <mkdir dir="${build.lib}"/>
       <mkdir dir="${build.lib}/subdir"/>
-      
+
       <!-- build naming.jar -->
       <jar destfile="${build.lib}/naming.jar">
          <fileset dir="${build.classes}">
@@ -30,7 +30,7 @@
             <include name="login-config-service.xml"/>
          </fileset>
       </jar>
-      
+
       <!-- build remote-naming.jar -->
       <jar destfile="${build.lib}/remote-naming.jar">
          <fileset dir="${build.classes}">
@@ -43,7 +43,7 @@
             <include name="**/*.xml"/>
          </fileset>
       </jar>
-      
+
       <!-- build naminga.jar -->
       <jar destfile="${build.lib}/subdir/naminga.jar">
          <fileset dir="${build.classes}">
@@ -56,7 +56,7 @@
             <include name="META-INF/*.xml"/>
          </fileset>
       </jar>
-      
+
       <!-- build namingb.jar -->
       <jar destfile="${build.lib}/namingb.jar">
          <fileset dir="${build.classes}">
@@ -69,7 +69,7 @@
             <include name="META-INF/*.xml"/>
          </fileset>
       </jar>
-      
+
       <!-- build naming.ear -->
       <jar destfile="${build.lib}/naming.ear">
          <fileset dir="${build.lib}">
@@ -80,7 +80,7 @@
             <include name="META-INF/*.xml"/>
          </fileset>
       </jar>
-      
+
       <jar destfile="${build.lib}/naming-readonly.sar">
          <metainf dir="${build.resources}/naming/services">
             <include name="jboss-service.xml"/>
@@ -89,7 +89,7 @@
             <include name="org/jboss/test/naming/interceptors/*"/>
          </fileset>
       </jar>
-      
+
       <!-- A pooled invoker test sar -->
       <jar destfile="${build.lib}/naming-pooled.sar">
          <zipfileset dir="${build.resources}/naming/services"
@@ -114,6 +114,16 @@
             <include name="org/jboss/test/naming/factory/*"/>
          </fileset>
       </jar>
-      
+
+      <!-- Test of naming restart -->
+      <jar destfile="${build.lib}/naming-restart.sar">
+         <zipfileset dir="${build.resources}/naming/restart"
+            fullpath="META-INF/jboss-service.xml">
+            <include name="jboss-service.xml"/>
+         </zipfileset>
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/test/naming/restart/*"/>
+         </fileset>
+      </jar>
    </target>
 </project>

Copied: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart (from rev 64875, branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart)

Deleted: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/NonDeserializable.java
===================================================================
--- branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/NonDeserializable.java	2007-08-25 06:18:52 UTC (rev 64875)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/NonDeserializable.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -1,47 +0,0 @@
-/*
- * 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.jboss.test.naming.restart;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- * Class that throws NoSuchObjectException in deserialization.
- * @author bstansberry
- */
-public class NonDeserializable implements Serializable
-{
-   private static final long serialVersionUID = 0L;
-
-   private void writeObject(java.io.ObjectOutputStream out)
-   throws IOException
-   {
-      out.defaultWriteObject();
-   }
-   
-   private void readObject(java.io.ObjectInputStream in)
-   throws IOException, ClassNotFoundException
-   {
-      throw new java.rmi.NoSuchObjectException("Let's see how this is handled");
-   }
-}

Copied: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/NonDeserializable.java (from rev 64875, branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/NonDeserializable.java)
===================================================================
--- branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/NonDeserializable.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/NonDeserializable.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -0,0 +1,47 @@
+/*
+ * 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.jboss.test.naming.restart;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ * Class that throws NoSuchObjectException in deserialization.
+ * @author bstansberry
+ */
+public class NonDeserializable implements Serializable
+{
+   private static final long serialVersionUID = 0L;
+
+   private void writeObject(java.io.ObjectOutputStream out)
+   throws IOException
+   {
+      out.defaultWriteObject();
+   }
+   
+   private void readObject(java.io.ObjectInputStream in)
+   throws IOException, ClassNotFoundException
+   {
+      throw new java.rmi.NoSuchObjectException("Let's see how this is handled");
+   }
+}

Deleted: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java
===================================================================
--- branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java	2007-08-25 06:18:52 UTC (rev 64875)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -1,158 +0,0 @@
-/*
- * 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.jboss.test.naming.restart;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-
-import org.jboss.logging.Logger;
-import org.jnp.interfaces.MarshalledValuePair;
-import org.jnp.interfaces.Naming;
-import org.jnp.interfaces.NamingParser;
-
-/**
- * Binds an object into JNDI.
- * 
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public class ObjectBinder implements ObjectBinderMBean
-{
-   private static Logger log = Logger.getLogger(ObjectBinder.class);
-   
-   public static final String NAME = "NamingRestartBinding";
-   public static final String BAD_BINDING = "NamingRestartBadBinding";
-   public static final String VALUE = "VALUE";
-   public static final String SUBCONTEXT_NAME = "LocalSubcontext";
-//   private String providerURL;  
-   private NamingParser parser = new NamingParser();
-   private RestartNamingServiceMBean naming;
-   
-   public void setNamingService(RestartNamingServiceMBean naming)
-   {
-//      this.providerURL = (naming == null) 
-//                              ? null 
-//                              : naming.getBindAddress() + ":" + naming.getPort();
-      this.naming = naming;
-   }
-   
-   public void start() throws Exception
-   {      
-      // Standard JNDI
-      Context ctx = new InitialContext();
-      ctx.bind(NAME, VALUE);
-      log.info("Bound " + VALUE + " to " + ctx + " under " + NAME);
-      ctx.bind(BAD_BINDING, new NonDeserializable());
-      log.info("Bound a NonDeserializable to " + ctx + " under " + BAD_BINDING);
-      
-      // For some reason creating a context for our own JNDI doesn't work
-      // inside the server, so as a hack we directly deal with the NamingServer
-      // to bind the object
-      
-//    Properties env = new Properties();
-//    env.setProperty("java.naming.provider.url", providerURL);
-//    log.info("Env = " + env);
-//    Context ctx = new InitialContext(env);
-//    ctx.bind(NAME, VALUE);
-      
-      Naming namingServer = naming.getNamingInstance();
-      namingServer.bind(parser.parse(NAME), 
-                                      new MarshalledValuePair(VALUE), 
-                                      VALUE.getClass().getName());
-      log.info("Bound " + VALUE + " to " + namingServer + " under " + NAME);
-      Context sub = namingServer.createSubcontext(parser.parse(SUBCONTEXT_NAME));
-      sub.bind(parser.parse(NAME), VALUE);
-      log.info("Bound " + VALUE + " to " + sub + " under " + NAME);
-      
-      // NOTE: we must bind the NonDeserializable directly, or else the 
-      // NamingContext will wrap it in a MarshalledValuePair, which will
-      // defeat the test by triggering deserialization too late
-      namingServer.bind(parser.parse(BAD_BINDING), new NonDeserializable(), 
-                                     NonDeserializable.class.getName());
-
-      log.info("Bound a NonDeserializable to " + namingServer + " under " + BAD_BINDING);
-   }
-   
-   /* (non-Javadoc)
-    * @see org.jboss.test.naming.restart.ObjectBinderMBean#stop()
-    */
-   public void stop() throws Exception
-   {
-      // Standard JNDI
-      Context ctx = new InitialContext();
-      ctx.unbind(NAME);
-      log.info("Unbound " + NAME + " from " + ctx);
-      ctx.unbind(BAD_BINDING);
-      log.info("Unbound " + BAD_BINDING + " from " + ctx);
-      
-      // For some reason creating a context for our own JNDI doesn't work
-      // inside the server, so as a hack we directly deal with the NamingServer
-      // to bind the object
-      
-//    Properties env = new Properties();
-//    env.setProperty("java.naming.provider.url", providerURL);
-//    
-//    Context ctx = new InitialContext(env);
-//      ctx.unbind(NAME);
-      
-      Naming namingServer = naming.getNamingInstance();
-      try
-      {
-         namingServer.unbind(parser.parse(SUBCONTEXT_NAME + "/" + NAME));
-         log.info("Unbound " + SUBCONTEXT_NAME + "/" + NAME + " from " + namingServer);
-      }
-      catch (NameNotFoundException ignored)
-      {
-         // already unbound by test
-      }
-      try
-      {
-         namingServer.unbind(parser.parse(SUBCONTEXT_NAME));
-         log.info("Unbound " + SUBCONTEXT_NAME + " from " + namingServer);
-      }
-      catch (NameNotFoundException ignored)
-      {
-         // already unbound by test
-      }
-      try
-      {
-         namingServer.unbind(parser.parse(NAME));
-         log.info("Unbound " + NAME + " from " + namingServer);
-      }
-      catch (NameNotFoundException ignored)
-      {
-         // already unbound by test
-      }
-      try
-      {
-         namingServer.unbind(parser.parse(BAD_BINDING));
-         log.info("Unbound " + BAD_BINDING + " from " + namingServer);
-      }
-      catch (NameNotFoundException ignored)
-      {
-         // already unbound by test
-      }
-      
-   }
-}

Copied: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java (from rev 64875, branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java)
===================================================================
--- branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinder.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -0,0 +1,158 @@
+/*
+ * 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.jboss.test.naming.restart;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+
+import org.jboss.logging.Logger;
+import org.jnp.interfaces.MarshalledValuePair;
+import org.jnp.interfaces.Naming;
+import org.jnp.interfaces.NamingParser;
+
+/**
+ * Binds an object into JNDI.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public class ObjectBinder implements ObjectBinderMBean
+{
+   private static Logger log = Logger.getLogger(ObjectBinder.class);
+   
+   public static final String NAME = "NamingRestartBinding";
+   public static final String BAD_BINDING = "NamingRestartBadBinding";
+   public static final String VALUE = "VALUE";
+   public static final String SUBCONTEXT_NAME = "LocalSubcontext";
+//   private String providerURL;  
+   private NamingParser parser = new NamingParser();
+   private RestartNamingServiceMBean naming;
+   
+   public void setNamingService(RestartNamingServiceMBean naming)
+   {
+//      this.providerURL = (naming == null) 
+//                              ? null 
+//                              : naming.getBindAddress() + ":" + naming.getPort();
+      this.naming = naming;
+   }
+   
+   public void start() throws Exception
+   {      
+      // Standard JNDI
+      Context ctx = new InitialContext();
+      ctx.bind(NAME, VALUE);
+      log.info("Bound " + VALUE + " to " + ctx + " under " + NAME);
+      ctx.bind(BAD_BINDING, new NonDeserializable());
+      log.info("Bound a NonDeserializable to " + ctx + " under " + BAD_BINDING);
+      
+      // For some reason creating a context for our own JNDI doesn't work
+      // inside the server, so as a hack we directly deal with the NamingServer
+      // to bind the object
+      
+//    Properties env = new Properties();
+//    env.setProperty("java.naming.provider.url", providerURL);
+//    log.info("Env = " + env);
+//    Context ctx = new InitialContext(env);
+//    ctx.bind(NAME, VALUE);
+      
+      Naming namingServer = naming.getNamingInstance();
+      namingServer.bind(parser.parse(NAME), 
+                                      new MarshalledValuePair(VALUE), 
+                                      VALUE.getClass().getName());
+      log.info("Bound " + VALUE + " to " + namingServer + " under " + NAME);
+      Context sub = namingServer.createSubcontext(parser.parse(SUBCONTEXT_NAME));
+      sub.bind(parser.parse(NAME), VALUE);
+      log.info("Bound " + VALUE + " to " + sub + " under " + NAME);
+      
+      // NOTE: we must bind the NonDeserializable directly, or else the 
+      // NamingContext will wrap it in a MarshalledValuePair, which will
+      // defeat the test by triggering deserialization too late
+      namingServer.bind(parser.parse(BAD_BINDING), new NonDeserializable(), 
+                                     NonDeserializable.class.getName());
+
+      log.info("Bound a NonDeserializable to " + namingServer + " under " + BAD_BINDING);
+   }
+   
+   /* (non-Javadoc)
+    * @see org.jboss.test.naming.restart.ObjectBinderMBean#stop()
+    */
+   public void stop() throws Exception
+   {
+      // Standard JNDI
+      Context ctx = new InitialContext();
+      ctx.unbind(NAME);
+      log.info("Unbound " + NAME + " from " + ctx);
+      ctx.unbind(BAD_BINDING);
+      log.info("Unbound " + BAD_BINDING + " from " + ctx);
+      
+      // For some reason creating a context for our own JNDI doesn't work
+      // inside the server, so as a hack we directly deal with the NamingServer
+      // to bind the object
+      
+//    Properties env = new Properties();
+//    env.setProperty("java.naming.provider.url", providerURL);
+//    
+//    Context ctx = new InitialContext(env);
+//      ctx.unbind(NAME);
+      
+      Naming namingServer = naming.getNamingInstance();
+      try
+      {
+         namingServer.unbind(parser.parse(SUBCONTEXT_NAME + "/" + NAME));
+         log.info("Unbound " + SUBCONTEXT_NAME + "/" + NAME + " from " + namingServer);
+      }
+      catch (NameNotFoundException ignored)
+      {
+         // already unbound by test
+      }
+      try
+      {
+         namingServer.unbind(parser.parse(SUBCONTEXT_NAME));
+         log.info("Unbound " + SUBCONTEXT_NAME + " from " + namingServer);
+      }
+      catch (NameNotFoundException ignored)
+      {
+         // already unbound by test
+      }
+      try
+      {
+         namingServer.unbind(parser.parse(NAME));
+         log.info("Unbound " + NAME + " from " + namingServer);
+      }
+      catch (NameNotFoundException ignored)
+      {
+         // already unbound by test
+      }
+      try
+      {
+         namingServer.unbind(parser.parse(BAD_BINDING));
+         log.info("Unbound " + BAD_BINDING + " from " + namingServer);
+      }
+      catch (NameNotFoundException ignored)
+      {
+         // already unbound by test
+      }
+      
+   }
+}

Deleted: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinderMBean.java
===================================================================
--- branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinderMBean.java	2007-08-25 06:18:52 UTC (rev 64875)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinderMBean.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -1,24 +0,0 @@
-package org.jboss.test.naming.restart;
-
-
-public interface ObjectBinderMBean
-{
-
-   void setNamingService(RestartNamingServiceMBean naming);
-
-   /**
-    * Bind an object both in standard JNDI (to expose via HA-JNDI) and in our
-    * injected NamingServer
-    * 
-    * @throws Exception
-    */
-   void start() throws Exception;
-
-   /**
-    * Undoes the bindings done in start().
-    * 
-    * @throws Exception
-    */
-   void stop() throws Exception;
-
-}
\ No newline at end of file

Copied: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinderMBean.java (from rev 64875, branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinderMBean.java)
===================================================================
--- branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinderMBean.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/ObjectBinderMBean.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -0,0 +1,24 @@
+package org.jboss.test.naming.restart;
+
+
+public interface ObjectBinderMBean
+{
+
+   void setNamingService(RestartNamingServiceMBean naming);
+
+   /**
+    * Bind an object both in standard JNDI (to expose via HA-JNDI) and in our
+    * injected NamingServer
+    * 
+    * @throws Exception
+    */
+   void start() throws Exception;
+
+   /**
+    * Undoes the bindings done in start().
+    * 
+    * @throws Exception
+    */
+   void stop() throws Exception;
+
+}
\ No newline at end of file

Deleted: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartHANamingService.java
===================================================================
--- branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/RestartHANamingService.java	2007-08-25 06:18:52 UTC (rev 64875)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartHANamingService.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -1,77 +0,0 @@
-/*
- * 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.jboss.test.naming.restart;
-
-import org.jboss.ha.jndi.HANamingService;
-import org.jnp.interfaces.Naming;
-import org.jnp.interfaces.NamingContext;
-
-/**
- * Subclass of HANamingService that ensures we don't screw up
- * the in-VM NamingContext class static haServers map.
- * 
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public class RestartHANamingService extends HANamingService
-{
-
-   /**
-    * Create a new RestartHANamingService.
-    * 
-    */
-   public RestartHANamingService()
-   {
-      super();
-   }
-
-   protected void createService() throws Exception
-   {
-      Naming naming = NamingContext.getHANamingServerForPartition(clusterPartition.getPartitionName());
-      try
-      {
-         super.createService();
-      }
-      finally
-      {
-         if (naming == null)
-            NamingContext.removeHANamingServerForPartition(clusterPartition.getPartitionName());
-         else
-            NamingContext.setHANamingServerForPartition(clusterPartition.getPartitionName(), naming);
-      }
-   }
-
-   protected void stopService() throws Exception
-   {
-      Naming naming = NamingContext.getHANamingServerForPartition(clusterPartition.getPartitionName());
-      try
-      {
-         super.stopService();
-      }
-      finally
-      {
-         if (naming != null)
-            NamingContext.setHANamingServerForPartition(clusterPartition.getPartitionName(), naming);
-      }
-   }
-}

Copied: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartHANamingService.java (from rev 64875, branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/RestartHANamingService.java)
===================================================================
--- branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartHANamingService.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartHANamingService.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -0,0 +1,77 @@
+/*
+ * 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.jboss.test.naming.restart;
+
+import org.jboss.ha.jndi.HANamingService;
+import org.jnp.interfaces.Naming;
+import org.jnp.interfaces.NamingContext;
+
+/**
+ * Subclass of HANamingService that ensures we don't screw up
+ * the in-VM NamingContext class static haServers map.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public class RestartHANamingService extends HANamingService
+{
+
+   /**
+    * Create a new RestartHANamingService.
+    * 
+    */
+   public RestartHANamingService()
+   {
+      super();
+   }
+
+   protected void createService() throws Exception
+   {
+      Naming naming = NamingContext.getHANamingServerForPartition(clusterPartition.getPartitionName());
+      try
+      {
+         super.createService();
+      }
+      finally
+      {
+         if (naming == null)
+            NamingContext.removeHANamingServerForPartition(clusterPartition.getPartitionName());
+         else
+            NamingContext.setHANamingServerForPartition(clusterPartition.getPartitionName(), naming);
+      }
+   }
+
+   protected void stopService() throws Exception
+   {
+      Naming naming = NamingContext.getHANamingServerForPartition(clusterPartition.getPartitionName());
+      try
+      {
+         super.stopService();
+      }
+      finally
+      {
+         if (naming != null)
+            NamingContext.setHANamingServerForPartition(clusterPartition.getPartitionName(), naming);
+      }
+   }
+}

Deleted: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingService.java
===================================================================
--- branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingService.java	2007-08-25 06:18:52 UTC (rev 64875)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingService.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -1,67 +0,0 @@
-/*
- * 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.jboss.test.naming.restart;
-
-import java.rmi.server.UnicastRemoteObject;
-
-import org.jboss.naming.NamingService;
-import org.jnp.interfaces.Naming;
-import org.jnp.server.Main;
-
-/**
- * Overrides NamingService to unexport the naming stub in stopService().
- * Used to test what happens when this is done.
- * 
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision$
- */
-public class RestartNamingService extends NamingService 
-   implements RestartNamingServiceMBean
-{
-
-   /* (non-Javadoc)
-    * @see org.jboss.test.naming.restart.RestartNamingServiceMBean#getNaming()
-    */
-   public Naming getNamingInstance()
-   {
-      return getNamingServer().getServer();
-   }
-   
-   protected void startService() throws Exception
-   {
-      Main main = getNamingServer();
-      main.setUseGlobalService(false);
-      main.setInstallGlobalService(false);
-      
-      super.startService();
-   }
-
-   protected void stopService() throws Exception
-   {
-      super.stopService();
-      UnicastRemoteObject.unexportObject(getNamingServer().getServer(), true);
-   }
-   
-   
-   
-}

Copied: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingService.java (from rev 64875, branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingService.java)
===================================================================
--- branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingService.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingService.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -0,0 +1,67 @@
+/*
+ * 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.jboss.test.naming.restart;
+
+import java.rmi.server.UnicastRemoteObject;
+
+import org.jboss.naming.NamingService;
+import org.jnp.interfaces.Naming;
+import org.jnp.server.Main;
+
+/**
+ * Overrides NamingService to unexport the naming stub in stopService().
+ * Used to test what happens when this is done.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public class RestartNamingService extends NamingService 
+   implements RestartNamingServiceMBean
+{
+
+   /* (non-Javadoc)
+    * @see org.jboss.test.naming.restart.RestartNamingServiceMBean#getNaming()
+    */
+   public Naming getNamingInstance()
+   {
+      return getNamingServer().getServer();
+   }
+   
+   protected void startService() throws Exception
+   {
+      Main main = getNamingServer();
+      main.setUseGlobalService(false);
+      main.setInstallGlobalService(false);
+      
+      super.startService();
+   }
+
+   protected void stopService() throws Exception
+   {
+      super.stopService();
+      UnicastRemoteObject.unexportObject(getNamingServer().getServer(), true);
+   }
+   
+   
+   
+}

Deleted: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingServiceMBean.java
===================================================================
--- branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingServiceMBean.java	2007-08-25 06:18:52 UTC (rev 64875)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingServiceMBean.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -1,16 +0,0 @@
-package org.jboss.test.naming.restart;
-
-import org.jboss.naming.NamingServiceMBean;
-import org.jnp.interfaces.Naming;
-
-public interface RestartNamingServiceMBean extends NamingServiceMBean
-{
-   boolean getUseGlobalService();
-   void setUseGlobalService(boolean useGlobal);
-
-   boolean getInstallGlobalService();
-   void setInstallGlobalService(boolean installGlobal);
-
-   Naming getNamingInstance();
-
-}
\ No newline at end of file

Copied: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingServiceMBean.java (from rev 64875, branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingServiceMBean.java)
===================================================================
--- branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingServiceMBean.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/restart/RestartNamingServiceMBean.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -0,0 +1,16 @@
+package org.jboss.test.naming.restart;
+
+import org.jboss.naming.NamingServiceMBean;
+import org.jnp.interfaces.Naming;
+
+public interface RestartNamingServiceMBean extends NamingServiceMBean
+{
+   boolean getUseGlobalService();
+   void setUseGlobalService(boolean useGlobal);
+
+   boolean getInstallGlobalService();
+   void setInstallGlobalService(boolean installGlobal);
+
+   Naming getNamingInstance();
+
+}
\ No newline at end of file

Copied: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/test/NamingRestartUnitTestCase.java (from rev 64875, branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/main/org/jboss/test/naming/test/NamingRestartUnitTestCase.java)
===================================================================
--- branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/test/NamingRestartUnitTestCase.java	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/main/org/jboss/test/naming/test/NamingRestartUnitTestCase.java	2007-08-25 06:39:46 UTC (rev 64876)
@@ -0,0 +1,470 @@
+/*
+ * 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.jboss.test.naming.test;
+
+import java.util.Hashtable;
+import java.util.Properties;
+
+import javax.naming.Binding;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameClassPair;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.naming.restart.ObjectBinder;
+import org.jnp.interfaces.MarshalledValuePair;
+import org.jnp.interfaces.NamingContext;
+
+/**
+ * A NamingRestartUnitTestCase.
+ * 
+ * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
+ * @version $Revision$
+ */
+public class NamingRestartUnitTestCase extends JBossTestCase
+{
+   private static final String NAMING_PORT = "19099";
+   private static final String HA_NAMING_PORT = "19100";
+   private static final String DISCOVERY_ADDRESS = "230.9.9.9";
+   private static final String DISCOVERY_PORT = "19102";
+   private static final String PARTITION_NAME = "DefaultPartition";
+ 
+   private static final String BIND_NAME = "BindName";
+   private static final String BIND_VALUE = "BindValue";
+   
+   private static final String SUBCONTEXT_NAME = "RemoteSubcontext";
+   
+   private static boolean deployed = false;
+   
+   public NamingRestartUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(NamingRestartUnitTestCase.class, null);
+   }
+   
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      
+      if (!deployed)
+         deploy("naming-restart.sar");
+      deployed = true;
+   }
+   
+   
+   
+   protected void tearDown() throws Exception
+   {
+      if (deployed)
+      {
+         undeploy("naming-restart.sar");
+         deployed = false;
+      }
+      
+      super.tearDown();
+   }
+
+   public void testBind() throws Exception
+   {
+      log.info("Running testBind()");
+      
+      Properties env = createNamingEnvironment(NAMING_PORT);
+      
+      Context ctx1 = new InitialContext(env);
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+      
+      // HOLD ONTO REF to ctx1 so the ref to it does not get gc'ed from
+      // static map in org.jnp.interfaces.NamingContext.
+      
+      // Redeploy the naming service
+      redeployNaming();
+      
+      Context ctx2 = new InitialContext(env);
+      try
+      {
+         ctx2.bind(BIND_NAME, BIND_VALUE);
+      }
+      catch (NamingException e)
+      {
+         log.error("Caught NamingException", e);
+         fail(e.getMessage());
+      }
+      
+      assertEquals(BIND_VALUE, ctx2.lookup(BIND_NAME));
+      
+      // Confirm the original context is still good
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+   }
+   
+   public void testCreateSubcontext() throws Exception
+   {
+      log.info("Running testCreateSubcontext()");
+      
+      Properties env = createNamingEnvironment(NAMING_PORT);
+      
+      Context ctx1 = new InitialContext(env);
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+      
+      // HOLD ONTO REF to ctx1 so the ref to it does not get gc'ed from
+      // static map in org.jnp.interfaces.NamingContext.
+      
+      // Redeploy the naming service
+      redeployNaming();
+      
+      Context ctx2 = new InitialContext(env);
+      try
+      {
+         Context sub = ctx2.createSubcontext(SUBCONTEXT_NAME);
+         sub.bind(BIND_NAME, BIND_VALUE);
+         assertEquals("Proper bind to " + SUBCONTEXT_NAME, BIND_VALUE, sub.lookup(BIND_NAME));
+      }
+      catch (NamingException e)
+      {
+         log.error("Caught NamingException", e);
+         fail(e.getMessage());
+      }
+      
+      // Confirm the original context is still good
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+   }
+   
+   public void testLookupAfterHANamingRestart() throws Exception
+   {
+      log.info("Running testLookupAfterHANamingRestart");
+      
+      lookupTest(createNamingEnvironment(HA_NAMING_PORT));
+   }
+   
+   public void testAutoDiscoveryLookupAfterHANamingRestart() throws Exception
+   {
+      log.info("Running testAutoDiscoveryLookupAfterHANamingRestart");
+      
+      lookupTest(createNamingEnvironment(DISCOVERY_ADDRESS, DISCOVERY_PORT));
+   }
+
+   public void testLookupAfterNamingRestart() throws Exception
+   {
+      log.info("Running testLookupAfterNamingRestart");
+      
+      lookupTest(createNamingEnvironment(NAMING_PORT));
+   }
+   
+   private void lookupTest(Hashtable env) throws Exception
+   {
+      Context ctx1 = createInitialContext(env);
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+      
+      // HOLD ONTO REF to ctx1 so the ref to it does not get gc'ed from
+      // static map in org.jnp.interfaces.NamingContext.
+      
+      // Redeploy the naming service
+      redeployNaming();
+      
+      Context ctx2 = createInitialContext(env);
+      NamingException ne = null;
+      try
+      {
+         assertEquals(ObjectBinder.VALUE, ctx2.lookup(ObjectBinder.NAME));
+      }
+      catch (NamingException e)
+      {
+         // Cache the exception to fail the test later, after
+         // we check that we can recover
+         log.error("Caught NamingException", e);
+         ne = e;
+      }
+      
+      // We recover from failure
+      if (ne != null)
+      {
+         try
+         {
+            assertEquals(ObjectBinder.VALUE, ctx2.lookup(ObjectBinder.NAME));
+         }
+         catch (Exception e)
+         {
+            log.error("Failed to reacquire server");
+         }
+         // Now fail due to the earlier failure
+         fail(ne.getMessage());         
+      }
+      
+      // Confirm the original context is still good
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+   }
+
+   private Context createInitialContext(Hashtable env) throws NamingException
+   {
+      Context ctx1 = new InitialContext(env);
+      if (ctx1.getEnvironment().get(NamingContext.JNP_DISCOVERY_GROUP) != null)
+      {
+         ctx1.removeFromEnvironment(Context.PROVIDER_URL);
+      }
+      return ctx1;
+   }
+   
+   public void testList() throws Exception
+   {
+      log.info("Running testList()");
+      
+      Properties env = createNamingEnvironment(NAMING_PORT);
+      
+      Context ctx1 = new InitialContext(env);
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+      
+      // HOLD ONTO REF to ctx1 so the ref to it does not get gc'ed from
+      // static map in org.jnp.interfaces.NamingContext.
+      
+      // Redeploy the naming service
+      redeployNaming();
+      
+      Context ctx2 = new InitialContext(env);
+      try
+      {
+         NamingEnumeration list = ctx2.list(ObjectBinder.SUBCONTEXT_NAME);
+         assertNotNull("NamingEnumeration returned", list);
+         assertTrue("NamingEnumeration has entry", list.hasMoreElements());
+         NameClassPair pair = (NameClassPair) list.next();
+         assertEquals(ObjectBinder.NAME, pair.getName());
+      }
+      catch (NamingException e)
+      {
+         log.error("Caught NamingException", e);
+         fail(e.getMessage());
+      }
+      
+      // Confirm the original context is still good
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+   }
+   
+   public void testListBindings() throws Exception
+   {
+      log.info("Running testListBindings()");
+      
+      Properties env = createNamingEnvironment(NAMING_PORT);
+      
+      Context ctx1 = new InitialContext(env);
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+      
+      // HOLD ONTO REF to ctx1 so the ref to it does not get gc'ed from
+      // static map in org.jnp.interfaces.NamingContext.
+      
+      // Redeploy the naming service
+      redeployNaming();
+      
+      Context ctx2 = new InitialContext(env);
+      try
+      {
+         NamingEnumeration list = ctx2.listBindings(ObjectBinder.SUBCONTEXT_NAME);
+         assertNotNull("NamingEnumeration returned", list);
+         assertTrue("NamingEnumeration has entry", list.hasMoreElements());
+         Binding binding = (Binding) list.next();
+         assertEquals(ObjectBinder.NAME, binding.getName());
+      }
+      catch (NamingException e)
+      {
+         log.error("Caught NamingException", e);
+         fail(e.getMessage());
+      }
+      
+      // Confirm the original context is still good
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+   }
+   
+   public void testLookupLink() throws Exception
+   {
+      log.info("Running testLookupLink()");
+      
+      Properties env = createNamingEnvironment(NAMING_PORT);
+      
+      Context ctx1 = new InitialContext(env);
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+      
+      // HOLD ONTO REF to ctx1 so the ref to it does not get gc'ed from
+      // static map in org.jnp.interfaces.NamingContext.
+      
+      // Redeploy the naming service
+      redeployNaming();
+      
+      Context ctx2 = new InitialContext(env);
+      try
+      {
+         Object obj = ctx2.lookupLink(ObjectBinder.NAME);
+         if (obj instanceof MarshalledValuePair)
+            obj = ((MarshalledValuePair) obj).get();
+         assertEquals(ObjectBinder.VALUE, obj);
+      }
+      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());
+         }
+      }
+      
+      // Confirm the original context is still good
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+   }
+   
+   public void testRebind() throws Exception
+   {
+      log.info("Running testRebind()");
+      
+      Properties env = createNamingEnvironment(NAMING_PORT);
+      
+      Context ctx1 = new InitialContext(env);
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+      
+      // HOLD ONTO REF to ctx1 so the ref to it does not get gc'ed from
+      // static map in org.jnp.interfaces.NamingContext.
+      
+      // Redeploy the naming service
+      redeployNaming();
+      
+      Context ctx2 = new InitialContext(env);
+      try
+      {
+         ctx2.rebind(ObjectBinder.NAME, ObjectBinder.VALUE);
+      }
+      catch (NamingException e)
+      {
+         log.error("Caught NamingException", e);
+         fail(e.getMessage());
+      }
+      
+      // Confirm the original context is still good
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+   }
+   
+   public void testUnbind() throws Exception
+   {
+      log.info("Running testUnbind()");
+      
+      Properties env = createNamingEnvironment(NAMING_PORT);
+      
+      Context ctx1 = new InitialContext(env);
+      assertEquals(ObjectBinder.VALUE, ctx1.lookup(ObjectBinder.NAME));
+      
+      // HOLD ONTO REF to ctx1 so the ref to it does not get gc'ed from
+      // static map in org.jnp.interfaces.NamingContext.
+      
+      // Redeploy the naming service
+      redeployNaming();
+      
+      Context ctx2 = new InitialContext(env);
+      try
+      {
+         ctx2.unbind(ObjectBinder.NAME);
+      }
+      catch (NamingException e)
+      {
+         log.error("Caught NamingException", e);
+         fail(e.getMessage());
+      }
+      
+      // Confirm the original context is still good
+      ctx1.bind(BIND_NAME, BIND_VALUE);
+   }
+   
+   public void testBadBindingHALookup() throws Exception
+   {
+      log.info("Running testBadBindingHALookup");
+      
+      badBindingLookupTest(HA_NAMING_PORT);
+   }
+
+   public void testBadBindingLookup() throws Exception
+   {
+      log.info("Running testBadBindingLookup");
+      
+      badBindingLookupTest(NAMING_PORT);
+   }
+   
+   /**
+    * Tests a lookup of an object that deliberately throws
+    * java.rmi.NoSuchObjectException when deserialized. Used 
+    * to check that this doesn't confuse the NamingContext.
+    * 
+    * @param port
+    * @throws Exception
+    */
+   private void badBindingLookupTest(String port) throws Exception
+   {
+      Properties env = createNamingEnvironment(port);
+      
+      Context ctx = new InitialContext(env);
+      try
+      {
+         ctx.lookup(ObjectBinder.BAD_BINDING);
+         fail("Did not fail in lookup of " + ObjectBinder.BAD_BINDING);
+      }
+      catch (NamingException good)
+      {
+         log.debug("Caught NamingException as expected: " + 
+                   good.getLocalizedMessage() + " -- cause: " + 
+                   good.getCause());
+      }
+      
+      // We recover from failure
+      assertEquals(ObjectBinder.VALUE, ctx.lookup(ObjectBinder.NAME));
+   }
+
+   private Properties createNamingEnvironment(String port)
+   {
+      String namingURL = getServerHost() + ":" + port;
+      Properties env = new Properties();
+      env.setProperty(Context.PROVIDER_URL, namingURL);
+      env.setProperty(NamingContext.JNP_DISABLE_DISCOVERY, "true");
+      return env;
+   }
+
+   private Properties createNamingEnvironment(String mcastAddress, String mcastPort)
+   {
+      Properties env = new Properties();
+//      env.setProperty(NamingContext.JNP_PARTITION_NAME, PARTITION_NAME);
+      env.setProperty(NamingContext.JNP_DISCOVERY_GROUP, mcastAddress);
+      env.setProperty(NamingContext.JNP_DISCOVERY_PORT, mcastPort);
+      return env;
+   }
+
+   private void redeployNaming() throws Exception
+   {
+      deployed = false;
+      redeploy("naming-restart.sar");
+      deployed = true;
+   }
+
+}

Copied: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/resources/naming/restart (from rev 64875, branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/resources/naming/restart)

Deleted: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/resources/naming/restart/jboss-service.xml
===================================================================
--- branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/resources/naming/restart/jboss-service.xml	2007-08-25 06:18:52 UTC (rev 64875)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/resources/naming/restart/jboss-service.xml	2007-08-25 06:39:46 UTC (rev 64876)
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- $Id$ -->
-
-<!-- ===================================================================== -->
-<!--  JBoss Server Configuration                                           -->
-<!-- ===================================================================== -->
-
-<server>
-
-   <!-- ==================================================================== -->
-   <!-- JNDI                                                                 -->
-   <!-- ==================================================================== -->
-
-   <!-- Use our own NamingService subclass that unexports the NamingServer
-        in stopService().  This better simulates a server shutdown. 
-        We don't really want to test a non-shutdown redeploy of the naming
-        service as that is a highly unlikely usage. -->
-   <mbean code="org.jboss.test.naming.restart.RestartNamingService"
-      name="jboss:service=RestartNaming">
-      
-      <!-- IMPORTANT Ensure we use our own NamingServer and don't screw up the
-           static ref to the std one in the server-side NamingContext class -->
-      <attribute name="UseGlobalService">false</attribute>      
-      <attribute name="InstallGlobalService">false</attribute>
-      
-      <attribute name="CallByValue">false</attribute>
-      <attribute name="Port">19099</attribute>
-      <attribute name="BindAddress">${jboss.bind.address}</attribute>
-      <!-- Use 0 == anonymous to minimize port conflict chances in test runs -->
-      <attribute name="RmiPort">0</attribute>
-      <attribute name="RmiBindAddress">${jboss.bind.address}</attribute>
-      <depends optional-attribute-name="LookupPool"
-         proxy-type="attribute">jboss.system:service=ThreadPool</depends>
-   </mbean>
-
-   <!-- Our own HA-JNDI that we can redeploy.  Subclasses std HA-JNDI service
-        to ensure we don't pollute static ref to the std HA-JNDI in the 
-        server-side NamingContext class -->
-   <mbean code="org.jboss.test.naming.restart.RestartHANamingService"
-      name="jboss:service=RestartHAJNDI">
-      
-	  <depends optional-attribute-name="ClusterPartition"
-         proxy-type="attribute">jboss:service=${jboss.partition.name:DefaultPartition}</depends>
-      <attribute name="BindAddress">${jboss.bind.address}</attribute>
-      <!-- Port on which the HA-JNDI stub is made available -->
-      <attribute name="Port">19100</attribute>
-      <!-- Use 0 == anonymous to minimize port conflict chances in test runs -->
-      <attribute name="RmiPort">0</attribute>
-      <attribute name="Backlog">50</attribute>
-      
-      <depends optional-attribute-name="LookupPool"
-         proxy-type="attribute">jboss.system:service=ThreadPool</depends>
-         
-      <attribute name="DiscoveryDisabled">false</attribute>
-      <attribute name="AutoDiscoveryBindAddress">${jboss.bind.address}</attribute>
-      <!-- Use a custom Multicast Address and group port for auto-discovery -->
-      <attribute name="AutoDiscoveryAddress">230.9.9.9</attribute>
-      <attribute name="AutoDiscoveryGroup">19102</attribute>
-      <!-- The TTL (time-to-live) for autodiscovery IP multicast packets -->
-      <attribute name="AutoDiscoveryTTL">1</attribute>
-      
-      <attribute name="LoadBalancePolicy">org.jboss.ha.framework.interfaces.RoundRobin</attribute>
-
-   </mbean>
-   
-   <!-- Binds an object in the above two naming services for remote lookup
-        by the test client -->
-   <mbean code="org.jboss.test.naming.restart.ObjectBinder"
-      name="jboss:service=RestartNamingObjectBinder">
-      
-      <depends optional-attribute-name="NamingService"
-         proxy-type="attribute">jboss:service=RestartNaming</depends>
-   </mbean>
-   
-
-</server>

Copied: branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/resources/naming/restart/jboss-service.xml (from rev 64875, branches/JBoss_4_0_5_GA_JBAS-4574/testsuite/src/resources/naming/restart/jboss-service.xml)
===================================================================
--- branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/resources/naming/restart/jboss-service.xml	                        (rev 0)
+++ branches/JBoss_4_0_5_GA_CP06_JBAS-4631/testsuite/src/resources/naming/restart/jboss-service.xml	2007-08-25 06:39:46 UTC (rev 64876)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id$ -->
+
+<!-- ===================================================================== -->
+<!--  JBoss Server Configuration                                           -->
+<!-- ===================================================================== -->
+
+<server>
+
+   <!-- ==================================================================== -->
+   <!-- JNDI                                                                 -->
+   <!-- ==================================================================== -->
+
+   <!-- Use our own NamingService subclass that unexports the NamingServer
+        in stopService().  This better simulates a server shutdown. 
+        We don't really want to test a non-shutdown redeploy of the naming
+        service as that is a highly unlikely usage. -->
+   <mbean code="org.jboss.test.naming.restart.RestartNamingService"
+      name="jboss:service=RestartNaming">
+      
+      <!-- IMPORTANT Ensure we use our own NamingServer and don't screw up the
+           static ref to the std one in the server-side NamingContext class -->
+      <attribute name="UseGlobalService">false</attribute>      
+      <attribute name="InstallGlobalService">false</attribute>
+      
+      <attribute name="CallByValue">false</attribute>
+      <attribute name="Port">19099</attribute>
+      <attribute name="BindAddress">${jboss.bind.address}</attribute>
+      <!-- Use 0 == anonymous to minimize port conflict chances in test runs -->
+      <attribute name="RmiPort">0</attribute>
+      <attribute name="RmiBindAddress">${jboss.bind.address}</attribute>
+      <depends optional-attribute-name="LookupPool"
+         proxy-type="attribute">jboss.system:service=ThreadPool</depends>
+   </mbean>
+
+   <!-- Our own HA-JNDI that we can redeploy.  Subclasses std HA-JNDI service
+        to ensure we don't pollute static ref to the std HA-JNDI in the 
+        server-side NamingContext class -->
+   <mbean code="org.jboss.test.naming.restart.RestartHANamingService"
+      name="jboss:service=RestartHAJNDI">
+      
+	  <depends optional-attribute-name="ClusterPartition"
+         proxy-type="attribute">jboss:service=${jboss.partition.name:DefaultPartition}</depends>
+      <attribute name="BindAddress">${jboss.bind.address}</attribute>
+      <!-- Port on which the HA-JNDI stub is made available -->
+      <attribute name="Port">19100</attribute>
+      <!-- Use 0 == anonymous to minimize port conflict chances in test runs -->
+      <attribute name="RmiPort">0</attribute>
+      <attribute name="Backlog">50</attribute>
+      
+      <depends optional-attribute-name="LookupPool"
+         proxy-type="attribute">jboss.system:service=ThreadPool</depends>
+         
+      <attribute name="DiscoveryDisabled">false</attribute>
+      <attribute name="AutoDiscoveryBindAddress">${jboss.bind.address}</attribute>
+      <!-- Use a custom Multicast Address and group port for auto-discovery -->
+      <attribute name="AutoDiscoveryAddress">230.9.9.9</attribute>
+      <attribute name="AutoDiscoveryGroup">19102</attribute>
+      <!-- The TTL (time-to-live) for autodiscovery IP multicast packets -->
+      <attribute name="AutoDiscoveryTTL">1</attribute>
+      
+      <attribute name="LoadBalancePolicy">org.jboss.ha.framework.interfaces.RoundRobin</attribute>
+
+   </mbean>
+   
+   <!-- Binds an object in the above two naming services for remote lookup
+        by the test client -->
+   <mbean code="org.jboss.test.naming.restart.ObjectBinder"
+      name="jboss:service=RestartNamingObjectBinder">
+      
+      <depends optional-attribute-name="NamingService"
+         proxy-type="attribute">jboss:service=RestartNaming</depends>
+   </mbean>
+   
+
+</server>




More information about the jboss-cvs-commits mailing list