[jbosscache-commits] JBoss Cache SVN: r6280 - in core/trunk/src/main/java/org/jboss/cache: lock and 1 other directory.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue Jul 15 13:32:55 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-07-15 13:32:55 -0400 (Tue, 15 Jul 2008)
New Revision: 6280

Modified:
   core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
   core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
Log:
Optimized hashing of Fqns and copying of node data.

Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2008-07-15 17:12:03 UTC (rev 6279)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java	2008-07-15 17:32:55 UTC (rev 6280)
@@ -106,7 +106,7 @@
       this.fqn = fqn;
 
       init();
-      setInternalState(data);
+      if (data != null && !data.isEmpty()) setInternalState(data);
    }
 
    /**

Modified: core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java	2008-07-15 17:12:03 UTC (rev 6279)
+++ core/trunk/src/main/java/org/jboss/cache/lock/MVCCLockManager.java	2008-07-15 17:32:55 UTC (rev 6280)
@@ -305,7 +305,7 @@
          initLocks(numLocks);
       }
 
-      int hashToIndex(Fqn fqn)
+      final int hashToIndex(Fqn fqn)
       {
          return (hash(fqn) >>> lockSegmentShift) & lockSegmentMask;
       }
@@ -315,12 +315,12 @@
        * Uses the same hash code spreader as most other java.util hash tables, except that this uses the string representation
        * of the object passed in.
        *
-       * @param x the object serving as a key
+       * @param fqn the object serving as a key
        * @return the hash code
        */
-      int hash(Object x)
+      final int hash(Fqn fqn)
       {
-         int h = x.toString().hashCode();
+         int h = fqn.hashCode();
          h += ~(h << 9);
          h ^= (h >>> 14);
          h += (h << 4);




More information about the jbosscache-commits mailing list