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

Manik Surtani manik at jboss.org
Tue Jul 24 18:57:58 EDT 2007


  User: msurtani
  Date: 07/07/24 18:57:58

  Modified:    src/org/jboss/cache/optimistic  DefaultDataVersion.java
  Log:
  Doesn't always throw DVE if the comparing class is not a DDV.
  
  Revision  Changes    Path
  1.9       +9 -1      JBossCache/src/org/jboss/cache/optimistic/DefaultDataVersion.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: DefaultDataVersion.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/optimistic/DefaultDataVersion.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- DefaultDataVersion.java	31 Jan 2007 16:44:29 -0000	1.8
  +++ DefaultDataVersion.java	24 Jul 2007 22:57:58 -0000	1.9
  @@ -76,7 +76,15 @@
            DefaultDataVersion dvOther = (DefaultDataVersion) other;
            return version > dvOther.version;
         }
  -      throw new DataVersioningException("Attempting to compare a custom data version (type " + other.getClass() + ") with a DefaultDataVersion instance.  Don't know how to compare!");
  +      else
  +      {
  +         // now try and swap things around to see if the other implementation knows how to compare against DefaultDataVersion.
  +         // could cause a problem if 'this' and 'other' have the same value, in which case other.newerThan() will return false
  +         // and this will return true, which is not strictly true at all.  So we try calling other.equals() first to test
  +         // this, assuming that other will be able to effectively test equality if they are equal.
  +
  +         return !other.equals(this) && !other.newerThan(this);
  +      }
      }
   
      public String toString()
  
  
  



More information about the jboss-cvs-commits mailing list