[jboss-cvs] JBossAS SVN: r58885 - branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 6 16:15:39 EST 2006


Author: jerrygauth
Date: 2006-12-06 16:15:38 -0500 (Wed, 06 Dec 2006)
New Revision: 58885

Modified:
   branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/HAPartitionImpl.java
Log:
Modified to allow suppression of partition JNDI registration; prerequisite for JBAS-2470

Modified: branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/HAPartitionImpl.java
===================================================================
--- branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/HAPartitionImpl.java	2006-12-06 21:10:30 UTC (rev 58884)
+++ branches/Branch_4_2/cluster/src/main/org/jboss/ha/framework/server/HAPartitionImpl.java	2006-12-06 21:15:38 UTC (rev 58885)
@@ -129,6 +129,8 @@
    protected MBeanServer server;
    /** Number of ms to wait for state */
    protected long state_transfer_timeout=60000;
+   /** Whether to bind the partition into JNDI */
+   protected boolean bindIntoJndi = true;
 
    /**
     * True if state was initialized during start-up.
@@ -287,7 +289,10 @@
       // Start the asynch listener handler thread
       asynchHandler.start();
       
-      // Bind ourself in the public JNDI space
+      // Bind ourself in the public JNDI space if configured to do so
+      if (!bindIntoJndi)
+    	  return;
+      
       Context ctx = new InitialContext();
       this.bind("/HAPartition/" + partitionName, this, HAPartitionImpl.class, ctx);
    }
@@ -400,20 +405,21 @@
          log.error("operation failed", e);
       }
 
-      String boundName = "/HAPartition/" + partitionName;
-
-      InitialContext ctx = new InitialContext();
-      try
+      if (bindIntoJndi)
       {
-
-         ctx.unbind(boundName);
+         String boundName = "/HAPartition/" + partitionName;
+         InitialContext ctx = new InitialContext();
+         try
+         {
+            ctx.unbind(boundName);
+         }
+         finally
+         {
+            ctx.close();
+         }
+         NonSerializableFactory.unbind (boundName);    	  
       }
-      finally
-      {
-         ctx.close();
-      }
-      NonSerializableFactory.unbind (boundName);
-
+      
       log.info("Partition " + partitionName + " closed.");
    }
 
@@ -1272,7 +1278,28 @@
       }
       log.debug("End notifyListeners, viewID: "+viewID);
    }
-
+   
+   /*
+    * Allows caller to specify whether the partition instance should be bound into JNDI.  Default value is true.
+    * This method must be called before the partition is started as the binding occurs during startup.
+    * 
+    * @param bind  Whether to bind the partition into JNDI.
+    */
+   public void setBindIntoJndi(boolean bind)
+   {
+	   bindIntoJndi = bind;
+   }
+   
+   /*
+    * Allows caller to determine whether the partition instance has been bound into JNDI.
+    * 
+    * @return true if the partition has been bound into JNDI.
+    */
+   public boolean getBindIntoJndi()
+   {
+	   return bindIntoJndi;
+   }
+   
    protected Vector translateAddresses (Vector jgAddresses)
    {
       if (jgAddresses == null)




More information about the jboss-cvs-commits mailing list