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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 29 17:24:47 EDT 2010


Author: bstansberry at jboss.com
Date: 2010-04-29 17:24:47 -0400 (Thu, 29 Apr 2010)
New Revision: 104347

Modified:
   trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartition.java
Log:
[JBAS-7978] Use JGroups RequestOptions.setExclusionList to exclude self from group RPCs

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	2010-04-29 21:24:01 UTC (rev 104346)
+++ trunk/cluster/src/main/java/org/jboss/ha/framework/server/ClusterPartition.java	2010-04-29 21:24:47 UTC (rev 104347)
@@ -233,9 +233,6 @@
 
    private final Vector<String> history = new Vector<String>();
 
-   /** The partition members other than this node */
-   private Vector<ClusterNode> otherMembers = null;
-   private Vector<Address> jgotherMembers = null;
    /** the local JG IP Address */
    private Address localJGAddress = null;
    /** me as a ClusterNode */
@@ -853,11 +850,6 @@
       {
          // we update the view id
          this.currentViewId = newView.getVid().getId();
-
-         // Keep a list of other members only for "exclude-self" RPC calls
-         this.jgotherMembers = cloneMembers(newView);
-         this.jgotherMembers.remove (this.channel.getAddress());
-         this.otherMembers = this.translateAddresses (this.jgotherMembers); // TRANSLATE!
          Vector<ClusterNode> translatedNewView = this.translateAddresses (cloneMembers(newView));
          this.logHistory ("New view: " + translatedNewView + " with viewId: " + this.currentViewId +
                      " (old view: " + this.members + " )");
@@ -883,7 +875,7 @@
                Object node = this.members.get(m);
                this.log.debug(node);
             }
-            this.log.info ("Other members: " + this.otherMembers.size ());
+            this.log.info ("Other members: " + (this.members.size() - 1));
             
             // Wake up the deployer thread blocking in waitForView
             this.notifyChannelLock();
@@ -1090,39 +1082,29 @@
    @SuppressWarnings("unchecked")
    public ArrayList callMethodOnCluster(String objName, String methodName,
        Object[] args, Class[] types, boolean excludeSelf, long methodTimeout, ResponseFilter filter) throws Exception
-   {
-      RspList rsp = null;
-      boolean trace = this.log.isTraceEnabled();
-
+   {      
       MethodCall m = new MethodCall(objName + "." + methodName, args, types);
       RspFilterAdapter rspFilter = filter == null ? null : new RspFilterAdapter(filter,this);
       RequestOptions ro = new RequestOptions( GroupRequest.GET_ALL, methodTimeout, false, rspFilter);
+      if (excludeSelf)
+      {
+         ro.setExclusionList(this.localJGAddress);
+      }
       
       if(this.channel.flushSupported())
       {
      	 this.flushBlockGate.await(this.getStateTransferTimeout());
       }
-      if (excludeSelf)
+      
+      boolean trace = this.log.isTraceEnabled();
+      if(trace)
       {
-         if( trace )
-         {
-            this.log.trace("callMethodOnCluster(true), objName="+objName
-               +", methodName="+methodName+", members="+this.jgotherMembers);
-         }
-         rsp = this.dispatcher.callRemoteMethods(this.jgotherMembers, m, ro);
+         this.log.trace("calling synchronous method on cluster, serviceName="+objName
+            +", methodName="+methodName+", members="+this.members+", excludeSelf="+excludeSelf);
       }
-      else
-      {
-         if( trace )
-         {
-            this.log.trace("callMethodOnCluster(false), objName="+objName
-               +", methodName="+methodName+", members="+this.members);
-         }
-         
-         rsp = this.dispatcher.callRemoteMethods(null, m, ro);
-      }
-
+      RspList rsp = this.dispatcher.callRemoteMethods(null, m, ro);
       return this.processResponseList(rsp, trace);
+      
     }
 
    /**
@@ -1334,32 +1316,23 @@
    public void callAsynchMethodOnCluster(String objName, String methodName,
       Object[] args, Class[] types, boolean excludeSelf) throws Exception
    {
-      boolean trace = this.log.isTraceEnabled();
-
       MethodCall m = new MethodCall(objName + "." + methodName, args, types);
       RequestOptions ro = new RequestOptions( GroupRequest.GET_NONE, this.getMethodCallTimeout());
+      if (excludeSelf)
+      {         
+         ro.setExclusionList(this.localJGAddress);
+      }
+      
       if(this.channel.flushSupported())
       {
      	 this.flushBlockGate.await(this.getStateTransferTimeout());
       }
-      if (excludeSelf)
+      if(this.log.isTraceEnabled())
       {
-         if( trace )
-         {
-            this.log.trace("callAsynchMethodOnCluster(true), objName="+objName
-               +", methodName="+methodName+", members="+this.jgotherMembers);
-         }
-         this.dispatcher.callRemoteMethods(this.jgotherMembers, m, ro);
+         this.log.trace("calling asynch method on cluster, serviceName="+objName
+            +", methodName="+methodName+", members="+this.members+", excludeSelf="+excludeSelf);
       }
-      else
-      {
-         if( trace )
-         {
-            this.log.trace("callAsynchMethodOnCluster(false), objName="+objName
-               +", methodName="+methodName+", members="+this.members);
-         }
-         this.dispatcher.callRemoteMethods(null, m, ro);
-      }
+      this.dispatcher.callRemoteMethods(null, m, ro);
    }
    
    // *************************




More information about the jboss-cvs-commits mailing list