[jboss-cvs] JBossAS SVN: r57123 - branches/JBoss_4_0_3_SP1_JBAS-3689/naming/src/main/org/jnp/server

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Sep 25 00:01:00 EDT 2006


Author: scott.stark at jboss.org
Date: 2006-09-25 00:00:59 -0400 (Mon, 25 Sep 2006)
New Revision: 57123

Modified:
   branches/JBoss_4_0_3_SP1_JBAS-3689/naming/src/main/org/jnp/server/Main.java
   branches/JBoss_4_0_3_SP1_JBAS-3689/naming/src/main/org/jnp/server/MainMBean.java
Log:
JBAS3689, Add a UseGlobalService which defines whether the MainMBean's Naming server will initialized from the existing NamingContext.setLocal global value

Modified: branches/JBoss_4_0_3_SP1_JBAS-3689/naming/src/main/org/jnp/server/Main.java
===================================================================
--- branches/JBoss_4_0_3_SP1_JBAS-3689/naming/src/main/org/jnp/server/Main.java	2006-09-25 02:27:43 UTC (rev 57122)
+++ branches/JBoss_4_0_3_SP1_JBAS-3689/naming/src/main/org/jnp/server/Main.java	2006-09-25 04:00:59 UTC (rev 57123)
@@ -42,7 +42,7 @@
    
    // Attributes ----------------------------------------------------
    /** The Naming interface server implementation */
-   protected NamingServer theServer;
+   protected Naming theServer;
    protected MarshalledObject serverStub;
    protected boolean isStubExported;
    /** The jnp server socket through which the NamingServer stub is vended */
@@ -77,6 +77,8 @@
    protected int rmiPort = 0;
    /** A flag indicating if theServer will be set as the NamingContext.setLocal value */
    protected boolean InstallGlobalService = true;
+   /** A flag indicating if theServer will try to use the NamingContext.setLocal value */
+   protected boolean UseGlobalService = true;
    protected Logger log;
    /** The thread pool used to handle jnp stub lookup requests */
    protected ThreadPool lookupPool;
@@ -201,7 +203,15 @@
    {
       this.InstallGlobalService = flag;
    }
-
+   public boolean getUseGlobalService()
+   {
+      return UseGlobalService;
+   }
+   public void setUseGlobalService(boolean flag)
+   {
+      this.UseGlobalService = flag;
+   }
+   
    public String getClientSocketFactory()
    {
       return clientSocketFactoryName;
@@ -243,11 +253,24 @@
       // Create the local naming service instance if it does not exist
       if( theServer == null )
       {
-         theServer = new NamingServer();
+         // See if we should try to reuse the current local server
+         if( UseGlobalService == true )
+            theServer = NamingContext.localServer;
+         // If not, or there is no server create one
+         if( theServer == null )
+            theServer = new NamingServer();
+         else
+         {
+            // We need to wrap the server to allow exporting it
+            NamingServerWrapper wrapper = new NamingServerWrapper(theServer);
+            theServer = wrapper;
+         }
+         log.debug("Using NamingServer: "+theServer);
          if( InstallGlobalService == true )
          {
             // Set local server reference
             NamingContext.setLocal(theServer);
+            log.debug("Installed global NamingServer: "+theServer);
          }
       }
 

Modified: branches/JBoss_4_0_3_SP1_JBAS-3689/naming/src/main/org/jnp/server/MainMBean.java
===================================================================
--- branches/JBoss_4_0_3_SP1_JBAS-3689/naming/src/main/org/jnp/server/MainMBean.java	2006-09-25 02:27:43 UTC (rev 57122)
+++ branches/JBoss_4_0_3_SP1_JBAS-3689/naming/src/main/org/jnp/server/MainMBean.java	2006-09-25 04:00:59 UTC (rev 57123)
@@ -49,6 +49,22 @@
     */ 
    public void setInstallGlobalService(boolean flag);
 
+   /** Get the UseGlobalService which defines whether the MainMBean's
+    * Naming server will initialized from the existing NamingContext.setLocal
+    * global value.
+    * 
+    * @return true if this should try to use VM global naming service, false otherwise 
+    */ 
+   public boolean getUseGlobalService();
+   /** Set the UseGlobalService which defines whether the MainMBean's
+    * Naming server will initialized from the existing NamingContext.setLocal global
+    * value. This allows one to export multiple servers via different transports
+    * and still share the same underlying naming service.
+    * 
+    * @return true if this should try to use VM global naming service, false otherwise 
+    */ 
+   public void setUseGlobalService(boolean flag);
+
    /** Get the RMIClientSocketFactory implementation class */
    public String getClientSocketFactory();
    /** Set the RMIClientSocketFactory implementation class */




More information about the jboss-cvs-commits mailing list