User: slaboure
  Date: 01/11/26 07:52:56

  Modified:    src/main/org/jboss/ha/framework/server ClusterPartition.java
                        ClusterPartitionMBean.java
  Log:
  Added javadoc comments.
  Reorganized code to JBoss coding conventions.
  
  Revision  Changes    Path
  1.8       +57 -51    
jbossmx/src/main/org/jboss/ha/framework/server/ClusterPartition.java
  
  Index: ClusterPartition.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbossmx/src/main/org/jboss/ha/framework/server/ClusterPartition.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ClusterPartition.java     2001/11/19 23:13:49     1.7
  +++ ClusterPartition.java     2001/11/26 15:52:55     1.8
  @@ -1,57 +1,46 @@
  -package org.jboss.ha.framework.server;
  -
  +/*
  + * JBoss, the OpenSource J2EE webOS
  + *
  + * Distributable under LGPL license.
  + * See terms of license at gnu.org.
  + */
   
  -import JavaGroups.JChannel;
  -import JavaGroups.Channel;
  +package org.jboss.ha.framework.server;
   
  -import org.jboss.logging.Logger;
  -import org.jboss.system.ServiceMBeanSupport;
   
  -import javax.management.MBeanServer;
  -import javax.management.ObjectName;
  -import javax.management.MalformedObjectNameException;
  -import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Iterator;
  -
  -import org.jboss.metadata.ClusterConfigMetaData;
   
  -import org.jboss.ha.framework.interfaces.HAPartition;
  +import javax.management.ObjectName;
   
  -import org.apache.log4j.Category;
  +import JavaGroups.Channel;
   
  +import org.jboss.system.ServiceMBeanSupport;
   
   /** 
    *   Management Bean for Cluster HAPartitions.  It will start a JavaGroups
    *   channel and initialize the ReplicantManager and DistributedStateService.
    *
  - *   @author [EMAIL PROTECTED]
  - *   @author [EMAIL PROTECTED]
  - *   @version $Revision: 1.7 $
  + *   @author <a href="mailto:[EMAIL PROTECTED]";>Bill Burke</a>.
  + *   @author <a href="mailto:[EMAIL PROTECTED]";>Sacha Labourey</a>.
  + *   @version $Revision: 1.8 $
    *
    * <p><b>Revisions:</b><br>
    */
  -public class ClusterPartition extends ServiceMBeanSupport implements 
ClusterPartitionMBean
  +
  +public class ClusterPartition
  +   extends ServiceMBeanSupport 
  +   implements ClusterPartitionMBean
   {
  -   protected final Collection syncMBeans = new ArrayList();
  -   protected String partitionName = ClusterConfigMetaData.DEFAULT_PARTITION;
  +   // Constants -----------------------------------------------------
  +   
  +   // Attributes ----------------------------------------------------
  +   
  +   protected final Collection syncMBeans = new java.util.ArrayList();
  +   protected String partitionName = 
org.jboss.metadata.ClusterConfigMetaData.DEFAULT_PARTITION;
      protected String jgProps = 
  -        /*
          "UDP:" +
          "PING:" +
  -       "FD(timeout=60000;shun=false):" +
  -       "STABLE:" +
  -       "MERGE:" +
  -       "NAKACK:" +
  -       "FLUSH:" +
  -       "GMS:" +
  -       "STATE_TRANSFER(trace=true):" +
  -       "VIEW_ENFORCER:" +
  -       "FLOWCONTROL:" +
  -       "QUEUE";
  -       */
  -       "UDP:" +
  -       "PING:" +
          "FD(trace=true;timeout=5000):" +
          "VERIFY_SUSPECT(trace=false;timeout=1500):" +
          "MERGE:" + 
  @@ -64,13 +53,16 @@
          "QUEUE";
      protected HAPartitionImpl partition;
      protected boolean deadlock_detection = false;
  -   protected JChannel channel;
  +   protected JavaGroups.JChannel channel;
      
  -   public String getName()
  -   {
  -      return partitionName;
  -   }
  -
  +   // Static --------------------------------------------------------
  +   
  +   // Constructors --------------------------------------------------
  +   
  +   // Public --------------------------------------------------------
  +   
  +   // ClusterPartitionMBean implementation 
----------------------------------------------
  +   
      public String getPartitionName()
      {
         return partitionName;
  @@ -101,20 +93,16 @@
         deadlock_detection = doit;
      }
   
  -   public ObjectName getObjectName(MBeanServer server, ObjectName name)
  -      throws javax.management.MalformedObjectNameException
  +   public ObjectName getObjectName (javax.management.MBeanServer server, ObjectName 
name) throws javax.management.MalformedObjectNameException
      {
         return new ObjectName(OBJECT_NAME);
      }
      
  -   public Collection getSynchronizedMBeans()
  +   public org.jboss.ha.framework.interfaces.HAPartition getHAPartition ()
      {
  -      synchronized (syncMBeans)
  -      {
  -         return new ArrayList(syncMBeans);
  -      }
  +      return this.partition;      
      }
  -
  +      
      public synchronized void setSynchronizedMBeans(Collection syncMBeans)
      {
         log.info("SynchronizedMBeans set to " + syncMBeans);
  @@ -124,15 +112,26 @@
            this.syncMBeans.addAll(syncMBeans);
         }
      }
  -   public HAPartition getHAPartition ()
  +
  +   public Collection getSynchronizedMBeans()
      {
  -      return this.partition;      
  +      synchronized (syncMBeans)
  +      {
  +         return new java.util.ArrayList(syncMBeans);
  +      }
      }
  +
  +   // ServiceMBeanSupport overrides 
---------------------------------------------------
      
  +   public String getName()
  +   {
  +      return partitionName;
  +   }
  +
      public void startService() throws Exception
      {
         log.info ("Creating JavaGroups JChannel");
  -      this.channel = new JChannel(jgProps);
  +      this.channel = new JavaGroups.JChannel(jgProps);
         channel.SetOpt(Channel.LOCAL, new Boolean(false));
         channel.SetOpt(Channel.GET_STATE_EVENTS, new Boolean(true));       
         channel.SetOpt(Channel.AUTO_RECONNECT, new Boolean(true));
  @@ -208,4 +207,11 @@
            log.error("Exception during shutdown", e);
         }
      }
  +   // Package protected ---------------------------------------------
  +   
  +   // Protected -----------------------------------------------------
  +   
  +   // Private -------------------------------------------------------
  +   
  +   // Inner classes -------------------------------------------------
   }
  
  
  
  1.4       +61 -34    
jbossmx/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java
  
  Index: ClusterPartitionMBean.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbossmx/src/main/org/jboss/ha/framework/server/ClusterPartitionMBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ClusterPartitionMBean.java        2001/11/19 23:13:49     1.3
  +++ ClusterPartitionMBean.java        2001/11/26 15:52:55     1.4
  @@ -1,34 +1,61 @@
  -package org.jboss.ha.framework.server;
  -
  -import java.util.Collection;
  -import org.jboss.ha.framework.interfaces.HAPartition;
  -
  -public interface ClusterPartitionMBean
  -   extends org.jboss.system.ServiceMBean
  -{
  -   // Constants -----------------------------------------------------
  -   static final String OBJECT_NAME = ":service=ClusterPartition";
  -
  -   String getPartitionName();
  -   void setPartitionName(String newName);
  -
  -   String getPartitionProperties(); // i.e. JavaGroups properties
  -   void setPartitionProperties(String newProps);
  -
  -   boolean getDeadlockDetection();
  -   void setDeadlockDetection(boolean doit);
  -
  -   Collection getSynchronizedMBeans();
  -   void setSynchronizedMBeans(Collection syncMBeans);
  -   
  -   // Access to the underlying HAPartition without going through JNDI
  -   //
  -   HAPartition getHAPartition ();
  -}
  -
  -
  -
  -    
  -
  -    
  -
  +/*
  + * JBoss, the OpenSource J2EE webOS
  + *
  + * Distributable under LGPL license.
  + * See terms of license at gnu.org.
  + */
  +
  +package org.jboss.ha.framework.server;
  +
  +
  +import java.util.Collection;
  +
  +import org.jboss.ha.framework.interfaces.HAPartition;
  +
  +/** 
  + *   Management Bean for Cluster HAPartitions.  It will start a JavaGroups
  + *   channel and initialize the ReplicantManager and DistributedStateService.
  + *
  + *   @author <a href="mailto:[EMAIL PROTECTED]";>Bill Burke</a>.
  + *   @author <a href="mailto:[EMAIL PROTECTED]";>Sacha Labourey</a>.
  + *   @version $Revision: 1.4 $
  + *
  + * <p><b>Revisions:</b><br>
  + */
  +
  +public interface ClusterPartitionMBean
  +   extends org.jboss.system.ServiceMBean
  +{
  +
  +   // Constants -----------------------------------------------------
  +
  +   static final String OBJECT_NAME = ":service=ClusterPartition";
  +
  +   /**
  +    * Name of the partition being built. All nodes/services belonging to 
  +    * a partition with the same name are clustered together.
  +    */
  +   String getPartitionName();
  +   void setPartitionName(String newName);
  +
  +   /**
  +    * Get JavaGroups property string a la JDBC
  +    * see <a href="http://www.javagroups.com/";>JavaGroups web site for more 
information</a>
  +    */
  +   String getPartitionProperties(); // i.e. JavaGroups properties
  +   void setPartitionProperties(String newProps);
  +
  +   /**
  +    * Determine if deadlock detection is enabled
  +    */
  +   boolean getDeadlockDetection();
  +   void setDeadlockDetection(boolean doit);
  +
  +   Collection getSynchronizedMBeans();
  +   void setSynchronizedMBeans(Collection syncMBeans);
  +   
  +   // Access to the underlying HAPartition without going through JNDI
  +   //  
  +   HAPartition getHAPartition ();
  +
  +}
  \ No newline at end of file
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to