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

Manik Surtani msurtani at jboss.com
Mon Nov 13 08:00:03 EST 2006


  User: msurtani
  Date: 06/11/13 08:00:03

  Modified:    src/org/jboss/cache/interceptors     Tag:
                        Branch_JBossCache_1_4_0
                        OptimisticReplicationInterceptor.java
                        TxInterceptor.java OptimisticNodeInterceptor.java
                        OptimisticValidatorInterceptor.java
  Log:
  Fixed test failures
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.21.2.3  +27 -19    JBossCache/src/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: OptimisticReplicationInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java,v
  retrieving revision 1.21.2.2
  retrieving revision 1.21.2.3
  diff -u -b -r1.21.2.2 -r1.21.2.3
  --- OptimisticReplicationInterceptor.java	11 Nov 2006 17:50:03 -0000	1.21.2.2
  +++ OptimisticReplicationInterceptor.java	13 Nov 2006 13:00:03 -0000	1.21.2.3
  @@ -205,6 +205,13 @@
         while (origCalls.hasNext())
         {
            JBCMethodCall origCall = (JBCMethodCall) origCalls.next();
  +         if (MethodDeclarations.isDataGravitationMethod(origCall.getMethodId()))
  +         {
  +            // no need to translate data gravitation calls.
  +            newList.add(origCall);
  +         }
  +         else
  +         {
            Object[] origArgs = origCall.getArgs();
            // get the data version associated with this orig call.
   
  @@ -225,6 +232,7 @@
            // and add it to the new list.
            newList.add(newCall);
         }
  +      }
         return newList;
      }
   
  
  
  
  1.48.2.10 +15 -6     JBossCache/src/org/jboss/cache/interceptors/TxInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TxInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/TxInterceptor.java,v
  retrieving revision 1.48.2.9
  retrieving revision 1.48.2.10
  diff -u -b -r1.48.2.9 -r1.48.2.10
  --- TxInterceptor.java	11 Nov 2006 19:45:38 -0000	1.48.2.9
  +++ TxInterceptor.java	13 Nov 2006 13:00:03 -0000	1.48.2.10
  @@ -536,10 +536,12 @@
                   JBCMethodCall method_call = (JBCMethodCall) it.next();
                   try
                   {
  -                   if (injectDataVersions)
  +                   if (injectDataVersions && !MethodDeclarations.isDataGravitationMethod(method_call.getMethodId()))
                      {
                         Object[] origArgs = method_call.getArgs();
  -                      injectDataVersion((DataVersion) origArgs[origArgs.length - 1]);
  +                      // there may be instances (e.g., data gravitation calls) where a data version is not passed in or not even relevant.
  +                      // make sure we are aware of this.
  +                      injectDataVersion(origArgs[origArgs.length - 1]);
                         // modify the call to the non-dataversioned counterpart since we've popped out the data version
                         Object[] args = new Object[origArgs.length - 1];
                         System.arraycopy(origArgs, 0, args, 0, args.length);
  @@ -578,12 +580,19 @@
   
   
   
  -   public void injectDataVersion(DataVersion v)
  +   public void injectDataVersion(Object obj)
  +   {
  +      if (obj instanceof DataVersion)
      {
         Option o = new Option();
  -      o.setDataVersion(v);
  +         o.setDataVersion((DataVersion) obj);
         getInvocationContext().setOptionOverrides(o);
      }
  +      else
  +      {
  +         log.debug("Object " + obj + " is not a DataVersion, not applying to this mod.");
  +      }
  +   }
       /**
        * Handles a commit or a rollback for a remote gtx.  Called by invoke().
        * @param m
  
  
  
  1.21.2.5  +4 -1      JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: OptimisticNodeInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java,v
  retrieving revision 1.21.2.4
  retrieving revision 1.21.2.5
  diff -u -b -r1.21.2.4 -r1.21.2.5
  --- OptimisticNodeInterceptor.java	11 Nov 2006 17:50:03 -0000	1.21.2.4
  +++ OptimisticNodeInterceptor.java	13 Nov 2006 13:00:03 -0000	1.21.2.5
  @@ -76,13 +76,16 @@
               workspace.setVersioningImplicit(false);
               DataVersion version = ctx.getOptionOverrides().getDataVersion();
               // "fail-more-silently" patch thanks to Owen Taylor - JBCACHE-767
  +
  +            // also, if this is a "remove", do we care if the node didn't exist?
  +
               if (workspaceNode != null)
               {
                  workspaceNode.setVersion(version);
               }
               else
               {
  -               if (ctx.getOptionOverrides() == null || !ctx.getOptionOverrides().isFailSilently())
  +               if (ctx.getOptionOverrides() == null || !ctx.getOptionOverrides().isFailSilently() && MethodDeclarations.isOptimisticPutMethod(meth))
                     throw new CacheException("Unable to set node version for " + getFqn(args) + ", node is null.");
               }
   
  
  
  
  1.25.2.6  +6 -1      JBossCache/src/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: OptimisticValidatorInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java,v
  retrieving revision 1.25.2.5
  retrieving revision 1.25.2.6
  diff -u -b -r1.25.2.5 -r1.25.2.6
  --- OptimisticValidatorInterceptor.java	11 Nov 2006 18:53:51 -0000	1.25.2.5
  +++ OptimisticValidatorInterceptor.java	13 Nov 2006 13:00:03 -0000	1.25.2.6
  @@ -128,7 +128,12 @@
               // if not, we have a problem...
               if (realNode == null && !workspaceNode.isCreated())
               {
  -                throw new CacheException("Real node for " + fqn + " is null, and this wasn't newly created in this tx!");
  +                throw new DataVersioningException("Real node for " + fqn + " is null, and this wasn't newly created in this tx!");
  +            }
  +
  +           if (realNode != null && workspaceNode.isCreated())
  +           {
  +              throw new DataVersioningException("Tx attempted to create " + fqn + " anew.  It has already been created since this tx started by another (possibly remote) tx.");
               }
   
               if (!workspaceNode.isCreated() )
  
  
  



More information about the jboss-cvs-commits mailing list