[jboss-cvs] JBossCache/src/org/jboss/cache ...

Manik Surtani msurtani at jboss.com
Fri Dec 8 07:35:36 EST 2006


  User: msurtani
  Date: 06/12/08 07:35:36

  Modified:    src/org/jboss/cache  Tag: Branch_JBossCache_1_4_0
                        TreeCache.java
  Log:
  Anycast should use reflection
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.195.2.31 +14 -5     JBossCache/src/org/jboss/cache/TreeCache.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCache.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TreeCache.java,v
  retrieving revision 1.195.2.30
  retrieving revision 1.195.2.31
  diff -u -b -r1.195.2.30 -r1.195.2.31
  --- TreeCache.java	8 Dec 2006 12:17:58 -0000	1.195.2.30
  +++ TreeCache.java	8 Dec 2006 12:35:35 -0000	1.195.2.31
  @@ -99,7 +99,7 @@
    * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
    * @author Brian Stansberry
    * @author Daniel Huang (dhuang at jboss.org)
  - * @version $Id: TreeCache.java,v 1.195.2.30 2006/12/08 12:17:58 msurtani Exp $
  + * @version $Id: TreeCache.java,v 1.195.2.31 2006/12/08 12:35:35 msurtani Exp $
    *          <p/>
    * @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
    */
  @@ -4324,10 +4324,8 @@
         if (log.isTraceEnabled())
            log.trace("callRemoteMethods(): valid members are " + validMembers + " method: " + method_call);
   
  -
  -      // if we are using buddy replication, all calls should use ANYCAST.  Otherwise, use the default (multicast).
  -      rsps = disp.callRemoteMethods(validMembers, method_call, mode, timeout, forceAnycast || buddyManager != null && buddyManager.isEnabled());
  -
  +      // if we are using buddy replication, all calls should use ANYCAST.  Otherwise, use the default (multicast).  Unless anycast is forced
  +      rsps = callRemoteMethodsViaReflection(validMembers, method_call, mode, timeout, forceAnycast || buddyManager != null && buddyManager.isEnabled());
   
         // a null response is 99% likely to be due to a marshalling problem - we throw a NSE, this needs to be changed when
         // JGroups supports http://jira.jboss.com/jira/browse/JGRP-193
  @@ -4366,6 +4364,17 @@
         return retval;
      }
   
  +   private RspList callRemoteMethodsViaReflection(Vector validMembers, MethodCall method_call, int mode, long timeout, boolean anycast) throws Exception
  +   {
  +      if (anycast && org.jgroups.Version.version >= 241)
  +      {
  +         // now consider using reflection since we need JGroups >= 2.4.1 for this.
  +         Method m = disp.getClass().getMethod("callRemoteMethods", new Class[]{Vector.class, MethodCall.class, int.class, long.class, boolean.class});
  +         return (RspList) m.invoke(disp, new Object[]{validMembers, method_call, new Integer(mode), new Long(timeout), Boolean.valueOf(anycast)});
  +      }
  +      else return disp.callRemoteMethods(validMembers, method_call, mode, timeout);
  +   }
  +
      /**
       * @param members
       * @param method
  
  
  



More information about the jboss-cvs-commits mailing list