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

Manik Surtani msurtani at jboss.com
Wed Dec 6 08:01:53 EST 2006


  User: msurtani
  Date: 06/12/06 08:01:53

  Modified:    src/org/jboss/cache  GlobalTransaction.java
  Log:
  JBCACHE-895
  
  Revision  Changes    Path
  1.17      +5 -24     JBossCache/src/org/jboss/cache/GlobalTransaction.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: GlobalTransaction.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/GlobalTransaction.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -b -r1.16 -r1.17
  --- GlobalTransaction.java	6 Dec 2006 12:54:46 -0000	1.16
  +++ GlobalTransaction.java	6 Dec 2006 13:01:53 -0000	1.17
  @@ -22,7 +22,7 @@
    *
    * @author <a href="mailto:bela at jboss.org">Bela Ban</a> Apr 12, 2003
    * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  - * @version $Revision: 1.16 $
  + * @version $Revision: 1.17 $
    */
   public class GlobalTransaction implements Externalizable
   {
  @@ -91,31 +91,12 @@
            return true;
         if (!(other instanceof GlobalTransaction))
            return false;
  -      return compareTo(other) == 0;
  -   }
   
  -   public int compareTo(Object o)
  -   {
  -      GlobalTransaction other;
  -      int comp;
  -      if (o == null || !(o instanceof GlobalTransaction))
  -         throw new ClassCastException("GlobalTransaction.compareTo(): other object is " + o);
  -      other = (GlobalTransaction) o;
  -      if (addr == null && other.addr == null)
  -         comp = 0;
  -      else if (addr != null && other.addr == null)
  -         comp = 1;
  -      else if (addr == null && other.addr != null)
  -         comp = -1;
  -      else
  -         comp = addr.compareTo(other.addr);
  +      if (other == null) throw new NullPointerException("GlobalTransaction.compareTo(): other object is null");
   
  -      if (comp == 0)
  -      {
  -         if (id < other.getId()) comp = -1;
  -         else if (id > other.getId()) comp = 1;
  -      }
  -      return comp;
  +      GlobalTransaction otherGtx = (GlobalTransaction) other;
  +
  +      return (addr == null && otherGtx.addr == null) || (addr != null && otherGtx.addr != null && addr.compareTo(otherGtx.addr) == 0) && id == otherGtx.id;
      }
   
      public String toString()
  
  
  



More information about the jboss-cvs-commits mailing list