You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by pe...@apache.org on 2012/01/20 01:26:36 UTC

svn commit: r1233702 [2/2] - in /river/jtsk/skunk/peterConcurrentPolicy: ./ high-scale-lib/ qa/ qa/src/com/sun/jini/qa/resources/ qa/src/com/sun/jini/test/impl/start/ qa/src/com/sun/jini/test/impl/start/aggregatepolicyprovider/ qa/src/com/sun/jini/test...

Modified: river/jtsk/skunk/peterConcurrentPolicy/src/org/apache/river/impl/util/WeakReferenceKey.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/peterConcurrentPolicy/src/org/apache/river/impl/util/WeakReferenceKey.java?rev=1233702&r1=1233701&r2=1233702&view=diff
==============================================================================
--- river/jtsk/skunk/peterConcurrentPolicy/src/org/apache/river/impl/util/WeakReferenceKey.java (original)
+++ river/jtsk/skunk/peterConcurrentPolicy/src/org/apache/river/impl/util/WeakReferenceKey.java Fri Jan 20 00:26:34 2012
@@ -38,7 +38,7 @@ class WeakReferenceKey<T> extends WeakRe
     WeakReferenceKey(T k, ReferenceQueue<? super T> q) {
         super(k,q);
         int hash = 7;
-        hash = 29 * hash + System.identityHashCode(k);
+        hash = 29 * hash + k.hashCode();
         hash = 29 * hash + k.getClass().hashCode();
         this.hash = hash;
     }
@@ -60,9 +60,14 @@ class WeakReferenceKey<T> extends WeakRe
 
     @Override
     public int hashCode() {
-        Object referent = get();
-        int hash = this.hash;
-        if (referent != null) hash = referent.hashCode();
+        Object k = get();
+        int hash = 7;
+        if (k != null) {
+            hash = 29 * hash + k.hashCode();
+            hash = 29 * hash + k.getClass().hashCode();
+        } else {
+            hash = this.hash;
+        }
         return hash;
     }