[jboss-cvs] JBossAS SVN: r59851 - trunk/cluster/src/main/org/jboss/ha/framework/server.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 19 13:25:40 EST 2007


Author: jerrygauth
Date: 2007-01-19 13:25:40 -0500 (Fri, 19 Jan 2007)
New Revision: 59851

Modified:
   trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
Log:
JBAS-2560 prerequisite

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2007-01-19 18:21:34 UTC (rev 59850)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/ClusterPartition.java	2007-01-19 18:25:40 UTC (rev 59851)
@@ -152,6 +152,8 @@
    protected Logger clusterLifeCycleLog;   
    /** The current cluster view id */
    protected long currentViewId = -1;
+   /** Whether to bind the partition into JNDI */
+   protected boolean bindIntoJndi = true;
    
    private RpcDispatcher dispatcher = null;
 
@@ -340,7 +342,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/" + getPartitionName(), this, ClusterPartition.class, ctx);
          log.debug("Bound in JNDI under /HAPartition/" + getPartitionName());
@@ -396,20 +401,21 @@
          log.error("operation failed", e);
       }
 
-     String boundName = "/HAPartition/" + getPartitionName();
+      if (bindIntoJndi)
+      {
+         String boundName = "/HAPartition/" + getPartitionName();
+         InitialContext ctx = new InitialContext();
+         try
+         {
+            ctx.unbind(boundName);
+         }
+         finally
+         {
+            ctx.close();
+         }
+         NonSerializableFactory.unbind (boundName);         
+      }
 
-     InitialContext ctx = new InitialContext();
-     try
-     {
-        ctx.unbind(boundName);
-     }
-     finally
-     {
-        ctx.close();
-     }
-
-     NonSerializableFactory.unbind (boundName);
-
      log.info("Partition " + getPartitionName() + " stopped.");
    }
    
@@ -1250,7 +1256,29 @@
       
       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