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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 14 21:02:29 EDT 2009


Author: bstansberry at jboss.com
Date: 2009-10-14 21:02:29 -0400 (Wed, 14 Oct 2009)
New Revision: 94908

Modified:
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartition.java
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartitionMBean.java
Log:
[JBAS-7157] Indicate a merge in view change logging
[JBAS-7209] Remove deprecated nodeAddress property
Clean out deprecated methods
Clean up compiler warnings

Modified: trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartition.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartition.java	2009-10-15 00:59:26 UTC (rev 94907)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartition.java	2009-10-15 01:02:29 UTC (rev 94908)
@@ -1,6 +1,6 @@
 /*
  * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2009 Red Hat, Inc. and individual contributors
  * as indicated by the @author tags. See the copyright.txt file in the
  * distribution for a full listing of individual contributors.
  *
@@ -28,7 +28,6 @@
 import java.io.OutputStream;
 import java.io.Serializable;
 import java.lang.ref.WeakReference;
-import java.net.InetAddress;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -207,7 +206,6 @@
    private   ChannelFactory channelFactory;
    private   String stackName;
    private   String partitionName = JBossASConfigurationInitializer.VALUE_PARTITION_NAME_DEFAULT;
-   private   InetAddress nodeAddress = null;
    private   long state_transfer_timeout=60000;
    private   long method_call_timeout=60000;
    
@@ -236,8 +234,6 @@
    private Vector<Address> jgotherMembers = null;
    /** the local JG IP Address */
    private Address localJGAddress = null;
-   /** The cluster transport protocol address string */
-   private String nodeName;
    /** me as a ClusterNode */
    private ClusterNode me = null;
    /** The JGroups partition channel */
@@ -393,7 +389,6 @@
          this.log.debug("get nodeName");
          this.localJGAddress = this.channel.getLocalAddress();
          this.me = new ClusterNodeImpl((IpAddress) this.localJGAddress);
-         this.nodeName = this.me.getName();
 
          this.verifyNodeIsUnique();
 
@@ -843,10 +838,10 @@
          this.currentViewId = newView.getVid().getId();
 
          // Keep a list of other members only for "exclude-self" RPC calls
-         this.jgotherMembers = (Vector<Address>)newView.getMembers().clone();
+         this.jgotherMembers = cloneMembers(newView);
          this.jgotherMembers.remove (this.channel.getLocalAddress());
          this.otherMembers = this.translateAddresses (this.jgotherMembers); // TRANSLATE!
-         Vector<ClusterNode> translatedNewView = this.translateAddresses ((Vector<Address>)newView.getMembers().clone());
+         Vector<ClusterNode> translatedNewView = this.translateAddresses (cloneMembers(newView));
          this.logHistory ("New view: " + translatedNewView + " with viewId: " + this.currentViewId +
                      " (old view: " + this.members + " )");
 
@@ -854,7 +849,7 @@
          // Save the previous view and make a copy of the new view
          Vector<ClusterNode> oldMembers = this.members;
 
-         Vector<Address> newjgMembers = (Vector<Address>)newView.getMembers().clone();
+         Vector<Address> newjgMembers = cloneMembers(newView);
          Vector<ClusterNode> newMembers = this.translateAddresses(newjgMembers); // TRANSLATE
          this.members = newMembers;
          this.jgmembers = newjgMembers;
@@ -880,15 +875,16 @@
          
          int difference = newMembers.size() - oldMembers.size();
          
+         boolean merge = newView instanceof MergeView;
          if (this.isCurrentNodeCoordinator ())
          {
             this.clusterLifeCycleLog.info ("New cluster view for partition " + this.getPartitionName() + " (id: " +
-                                      this.currentViewId + ", delta: " + difference + ") : " + this.members);
+                                      this.currentViewId + ", delta: " + difference + ", merge: " + merge + ") : " + this.members);
          }
          else
          {
             this.log.info("New cluster view for partition " + this.getPartitionName() + ": " +
-                     this.currentViewId + " (" + this.members + " delta: " + difference + ")");
+                     this.currentViewId + " (" + this.members + " delta: " + difference + ", merge: " + merge + ")");
          }
 
          // Build a ViewChangeEvent for the asynch listeners
@@ -968,7 +964,7 @@
    @ManagementProperty(use={ViewUse.STATISTIC}, description="The identifier for this node in cluster topology views")
    public String getNodeName()
    {
-      return this.nodeName;
+      return this.me == null ? null : this.me.getName();
    }
    
    @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The partition's name")
@@ -1560,7 +1556,7 @@
       {
          newMembers=new Vector<ClusterNode>();
       }
-      Vector<ClusterNode> dead=(Vector<ClusterNode>)oldMembers.clone();
+      Vector<ClusterNode> dead= cloneMembers(oldMembers);
       dead.removeAll(newMembers);
       this.log.debug("dead members: " + dead);
       return dead;
@@ -1582,7 +1578,7 @@
       {
          allMembers=new Vector<ClusterNode>();
       }
-      Vector<ClusterNode> newMembers=(Vector<ClusterNode>)allMembers.clone();
+      Vector<ClusterNode> newMembers= cloneMembers(allMembers);
       newMembers.removeAll(oldMembers);
       return newMembers;
    }
@@ -1592,18 +1588,17 @@
       Vector<View> originatingGroups)
    {
       this.log.debug("Begin notifyListeners, viewID: "+viewID);
+      List<HAMembershipListener> toNotify = null;
       synchronized(theListeners)
       {
          // JBAS-3619 -- don't hold synch lock while notifying
-         theListeners = (ArrayList<HAMembershipListener>) theListeners.clone();
+         toNotify = cloneListeners(theListeners);
       }
       
-      for (int i = 0; i < theListeners.size(); i++)
+      for (HAMembershipListener aListener : toNotify)
       {
-         HAMembershipListener aListener = null;
          try
          {
-            aListener = theListeners.get(i);
             if(originatingGroups != null && (aListener instanceof HAMembershipExtendedListener))
             {
                HAMembershipExtendedListener exListener = (HAMembershipExtendedListener) aListener;
@@ -1732,38 +1727,6 @@
       return buff.toString();
    }
 
-   /**
-    * Deprecated; always returns <code>false</code>.
-    * 
-    * @return <code>false</code>
-    * 
-    * @deprecated will be removed in next major release
-    */
-   @Deprecated
-   public boolean getDeadlockDetection()
-   {
-      return false;
-   }
-
-   /**
-    * Deprecated; logs a WARN message if invoked.
-    * 
-    * @param doIt ignored
-    * 
-    * @deprecated will be removed in next major release
-    */
-   @Deprecated
-   public void setDeadlockDetection(boolean doit)
-   {
-      log.warn("Property deadlockDetection has been deprecated; setting it has no effect");
-   }
-
-   @Deprecated
-   public HAPartition getHAPartition()
-   {
-      return this;
-   }
-
    @ManagementProperty(use={ViewUse.STATISTIC}, description="The release version of JGroups")
    public String getJGroupsVersion()
    {
@@ -1811,16 +1774,6 @@
       return this.stackName;
    }
 
-   public InetAddress getNodeAddress()
-   {
-      return this.nodeAddress;
-   }
-
-   public void setNodeAddress(InetAddress address)
-   {
-      this.nodeAddress = address;
-   }
-
    @ManagementProperty(description="Time (in ms) to allow for state transfer to finish")
    public long getStateTransferTimeout() {
       return this.state_transfer_timeout;
@@ -2416,6 +2369,9 @@
       
       private static class Sync extends AbstractQueuedSynchronizer
       {
+         /** The serialVersionUID */
+         private static final long serialVersionUID = 1L;
+         
          Sync(int state)
          {
             this.setState(state);
@@ -2447,11 +2403,6 @@
          this.sync.releaseShared(CLOSED);
       }
       
-      public void await() throws InterruptedException
-      {
-         this.sync.acquireSharedInterruptibly(0);
-      }
-      
       public boolean await(long timeout) throws InterruptedException
       {
          return this.sync.tryAcquireSharedNanos(0, TimeUnit.MILLISECONDS.toNanos(timeout));
@@ -2472,48 +2423,22 @@
       }
    }
    
-//   private synchronized void registerDRM()
-//   {
-//      MBeanServer mbs = getServer();
-//      if (this.replicantManager != null && mbs != null)
-//      {
-//         try
-//         {
-//            ObjectName oname = getDRMObjectName();
-//            mbs.registerMBean(this.replicantManager, oname);
-//         }
-//         catch (JMException e)
-//         {
-//            log.error("Unable to register DRM in JMX", e);
-//         }
-//      }
-//   }
+   @SuppressWarnings("unchecked")
+   private static Vector<Address> cloneMembers(View view)
+   {
+      return (Vector<Address>) view.getMembers().clone();
+   }
    
-//   private void unregisterDRM()
-//   {
-//      MBeanServer mbs = getServer();
-//      if (this.replicantManager != null && mbs != null)
-//      {
-//         try
-//         {
-//            ObjectName oname = getDRMObjectName();
-//            if (mbs.isRegistered(oname))
-//            {
-//               mbs.unregisterMBean(oname);
-//            }
-//         }
-//         catch (JMException e)
-//         {
-//            log.error("Unable to register DRM in JMX", e);
-//         }
-//      }
-//      
-//   }
-
-//   private ObjectName getDRMObjectName() throws MalformedObjectNameException
-//   {
-//      ObjectName oname = new ObjectName(DistributedReplicantManagerImpl.OBJECT_NAME_BASE + ",partitionName=" + getPartitionName());
-//      return oname;
-//   }
+   @SuppressWarnings("unchecked")
+   private static Vector<ClusterNode> cloneMembers(Vector<ClusterNode> toClone)
+   {
+      return (Vector<ClusterNode>) toClone.clone();
+   }
    
+   @SuppressWarnings("unchecked")
+   private static List<HAMembershipListener> cloneListeners(ArrayList<HAMembershipListener> toClone)
+   {
+      return (List<HAMembershipListener>) toClone.clone();
+   }
+   
 }

Modified: trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartitionMBean.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartitionMBean.java	2009-10-15 00:59:26 UTC (rev 94907)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartitionMBean.java	2009-10-15 01:02:29 UTC (rev 94908)
@@ -1,6 +1,6 @@
 /*
  * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2009 Red Hat, Inc. and individual contributors
  * as indicated by the @author tags. See the copyright.txt file in the
  * distribution for a full listing of individual contributors.
  *
@@ -21,14 +21,9 @@
  */
 package org.jboss.ha.framework.server;
 
-import java.net.InetAddress;
 import java.util.Vector;
 
-import javax.management.ObjectName;
-
-import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
 import org.jboss.ha.framework.interfaces.HAPartition;
-import org.jboss.mx.util.ObjectNameFactory;
 
 /** 
  * MBean interface for ClusterPartition.
@@ -43,14 +38,6 @@
    extends org.jboss.system.ServiceMBean
 {
    /**
-    * Not used.
-    * 
-    * @deprecated not used; will be removed in AS 6
-    */
-   @Deprecated
-   ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss:service=ClusterPartition");
-
-   /**
     * Name of the partition being built. All nodes/services belonging to 
     * a partition with the same name are clustered together.
     */
@@ -62,11 +49,6 @@
     */
    String getNodeName();
    
-   /**
-    * The node address used to generate the node name
-    */
-   InetAddress getNodeAddress();
-   
    /** The version of JGroups this is running on */
    String getJGroupsVersion();
 
@@ -80,16 +62,6 @@
     * ({@link HAPartition#callMethodOnCluster(String, String, Object[], Class[], boolean)}) 
     */ 
    long getMethodCallTimeout();
-
-   /**
-    * Deprecated; always returns <code>false</code>.
-    * 
-    * @return <code>false</code>
-    * 
-    * @deprecated will be removed in AS 6
-    */
-   @Deprecated
-   boolean getDeadlockDetection();
    
    /**
     * Returns whether this partition will synchronously notify any 
@@ -105,33 +77,8 @@
     *         is <code>false</code>.
     */
    public boolean getAllowSynchronousMembershipNotifications();
-
-   /** Access to the underlying HAPartition without going through JNDI
-    *
-    * @return the HAPartition for the cluster service
-    * 
-    * @deprecated will be removed in AS 6
-    */
-   @Deprecated
-   HAPartition getHAPartition ();
    
    /**
-    * Access to the DistributedReplicantManager implementation
-    * 
-    * @deprecated will be removed in AS 6
-    */
-   @Deprecated
-   DistributedReplicantManager getDistributedReplicantManager();
-   
-   /**
-    * Access to the DistributedState implementation
-    * 
-    * @deprecated will be removed in AS 6; use JBoss Cache for distributed caching
-    */
-   @Deprecated
-   org.jboss.ha.framework.interfaces.DistributedState getDistributedStateService();
-   
-   /**
     * Gets the configuration name under which our cache is registered
     * with the cache manager.
     */




More information about the jboss-cvs-commits mailing list