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

Brian Stansberry brian.stansberry at jboss.com
Thu Jul 20 22:51:30 EDT 2006


  User: bstansberry
  Date: 06/07/20 22:51:30

  Modified:    src/org/jboss/cache/marshall    Tag:
                        Branch_JBossCache_1_4_0_MUX
                        VersionAwareMarshaller.java
                        TreeCacheMarshaller140.java
                        LegacyTreeCacheMarshaller.java
  Log:
  Sync to JBossCache_1_4_0_GA
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.5.4.1   +9 -1      JBossCache/src/org/jboss/cache/marshall/VersionAwareMarshaller.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: VersionAwareMarshaller.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/VersionAwareMarshaller.java,v
  retrieving revision 1.5
  retrieving revision 1.5.4.1
  diff -u -b -r1.5 -r1.5.4.1
  --- VersionAwareMarshaller.java	8 Jun 2006 22:00:35 -0000	1.5
  +++ VersionAwareMarshaller.java	21 Jul 2006 02:51:30 -0000	1.5.4.1
  @@ -37,6 +37,7 @@
   
       private static final int VERSION_LEGACY = 1;
       private static final int VERSION_140 = 14;
  +    private static final int VERSION_200 =20;
   
       private int versionInt;
   
  @@ -54,6 +55,7 @@
   
           switch (versionInt)
           {
  +            case VERSION_200:
               case VERSION_140:
                   defaultMarshaller = new TreeCacheMarshaller140(manager, defaultInactive, useRegionBasedMarshalling);
                   marshallers.put(new Integer(VERSION_140), defaultMarshaller);
  @@ -62,6 +64,12 @@
                   defaultMarshaller = new LegacyTreeCacheMarshaller(manager, defaultInactive, useRegionBasedMarshalling);
                   marshallers.put(new Integer(VERSION_LEGACY), defaultMarshaller);
           }
  +
  +        if (log.isDebugEnabled())
  +        {
  +            log.debug("Initialised with version "+version+" and versionInt " + versionInt);
  +            log.debug("Using default marshaller " + defaultMarshaller.getClass());
  +        }
       }
   
       /**
  @@ -97,7 +105,7 @@
               int major = Integer.parseInt(versionComponents[0]);
               int minor = Integer.parseInt(versionComponents[1]);
   
  -            return minor > 3 ? (10 * major) + minor : 1;
  +            return (major > 1 || minor > 3) ? (10 * major) + minor : 1;
           }
           catch (Exception e)
           {
  
  
  
  1.1.4.1   +34 -19    JBossCache/src/org/jboss/cache/marshall/TreeCacheMarshaller140.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TreeCacheMarshaller140.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/TreeCacheMarshaller140.java,v
  retrieving revision 1.1
  retrieving revision 1.1.4.1
  diff -u -b -r1.1 -r1.1.4.1
  --- TreeCacheMarshaller140.java	8 Jun 2006 00:42:23 -0000	1.1
  +++ TreeCacheMarshaller140.java	21 Jul 2006 02:51:30 -0000	1.1.4.1
  @@ -11,7 +11,6 @@
   import org.jboss.cache.CacheException;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.GlobalTransaction;
  -import org.jboss.cache.rpc.RpcTreeCache;
   import org.jgroups.Address;
   import org.jgroups.blocks.MethodCall;
   import org.jgroups.stack.IpAddress;
  @@ -69,10 +68,28 @@
           if (useRegionBasedMarshalling)
           {
               // we first marshall the Fqn as a String (ugh!)
  -            JBCMethodCall call = (JBCMethodCall) o;
  +            
  +            // Just cast o to JBCMethodCall -- in the off chance its not
  +            // due to a subclass passing in something else, we'll just
  +            // deal with the CCE
  +           JBCMethodCall call = null;
  +           try
  +           {
  +              call = (JBCMethodCall) o;
               String fqnAsString = extractFqnAsString(call);
               marshallObject(fqnAsString, out, refMap);
           }
  +           catch (ClassCastException cce)
  +           {
  +              if (call == null)
  +              {
  +                 log.debug("Received non-JBCMethodCall " + o +" -- cannot extract Fqn so using null");
  +                 marshallObject(null, out, refMap);
  +              }
  +              else
  +                 throw cce;
  +           }
  +        }
   
           marshallObject(o, out, refMap);
       }
  @@ -152,21 +169,19 @@
       private String extractFqnAsString(JBCMethodCall call) throws Exception
       {
           String fqnAsString;
  -        if (call.getMethod().equals(MethodDeclarations.replicateMethod))
  +        switch (call.getMethodId())
           {
  +           case MethodDeclarations.replicateMethod_id:
               fqnAsString = extractFqnFromMethodCall(call);
  -        }
  -        else if (call.getMethod().equals(MethodDeclarations.replicateAllMethod))
  -        {
  +              break;
  +           case MethodDeclarations.replicateAllMethod_id:
               fqnAsString = extractFqnFromListOfMethodCall(call);
  -        }
  -        else if (call.getMethod().equals(RpcTreeCache.dispatchRpcCallMethod))
  -        {
  +              break;
  +           case MethodDeclarations.dispatchRpcCallMethod_id:
               JBCMethodCall call2 = (JBCMethodCall) call.getArgs()[1];
               fqnAsString = extractFqn(call2);
  -        }
  -        else
  -        {
  +              break;
  +           default:
               fqnAsString = extractFqn(call);
           }
   
  
  
  
  1.5.4.1   +32 -15    JBossCache/src/org/jboss/cache/marshall/LegacyTreeCacheMarshaller.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: LegacyTreeCacheMarshaller.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/marshall/LegacyTreeCacheMarshaller.java,v
  retrieving revision 1.5
  retrieving revision 1.5.4.1
  diff -u -b -r1.5 -r1.5.4.1
  --- LegacyTreeCacheMarshaller.java	8 Jun 2006 22:00:35 -0000	1.5
  +++ LegacyTreeCacheMarshaller.java	21 Jul 2006 02:51:30 -0000	1.5.4.1
  @@ -33,7 +33,7 @@
    * @author Ben Wang
    * @author Manik Surtani
     *
  - * @version $Id: LegacyTreeCacheMarshaller.java,v 1.5 2006/06/08 22:00:35 msurtani Exp $
  + * @version $Id: LegacyTreeCacheMarshaller.java,v 1.5.4.1 2006/07/21 02:51:30 bstansberry Exp $
    */
   public class LegacyTreeCacheMarshaller extends Marshaller
   {
  @@ -117,9 +117,16 @@
            * 1. replicate. Argument is another MethodCall. The followings are the one that we need to handle:
            * 2. replicateAll. List of MethodCalls. We can simply repeat the previous step by extract the first fqn only.
            */
  -        JBCMethodCall call = (JBCMethodCall) o; // either "replicate" or "replicateAll" now.
  +        JBCMethodCall call = null;
  +        String fqn = null;
  +        
  +        // Just cast o to JBCMethodCall -- in the off chance its not
  +        // due to a subclass passing in something else, we'll just
  +        // deal with the CCE
  +        try
  +        {
  +           call = (JBCMethodCall) o; // either "replicate" or "replicateAll" now.
   
  -        String fqn;
           switch (call.getMethodId())
           {
               case MethodDeclarations.replicateMethod_id:
  @@ -132,6 +139,16 @@
                   throw new IllegalStateException("LegacyTreeCacheMarshaller.objectToByteBuffer(): MethodCall name is either not "
                           + " replicate or replicateAll but : " + call.getName());
           }
  +        }
  +        catch (ClassCastException cce)
  +        {
  +           if (call == null)
  +           {
  +              log.debug("Received non-JBCMethodCall " + o +" -- cannot extract Fqn so using null");
  +           }
  +           else
  +              throw cce;
  +        }
   
           // Extract fqn and write it out in fixed format
           if (fqn == null) fqn = "NULL"; // can't write null. tis can be commit.
  
  
  



More information about the jboss-cvs-commits mailing list