hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdcry...@apache.org
Subject svn commit: r985383 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/util/SoftValue.java src/main/java/org/apache/hadoop/hbase/util/SoftValueMap.java src/main/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java
Date Fri, 13 Aug 2010 22:09:43 GMT
Author: jdcryans
Date: Fri Aug 13 22:09:42 2010
New Revision: 985383

URL: http://svn.apache.org/viewvc?rev=985383&view=rev
Log:
HBASE-2909  SoftValueSortedMap is broken, can generate NPEs

Removed:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/SoftValue.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/SoftValueMap.java
Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=985383&r1=985382&r2=985383&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Fri Aug 13 22:09:42 2010
@@ -475,6 +475,7 @@ Release 0.21.0 - Unreleased
    HBASE-2905  NPE when inserting mass data via REST interface (Sandy Yin via
                Andrew Purtell)
    HBASE-2908  Wrong order of null-check [in TIF] (Libor Dener via Stack)
+   HBASE-2909  SoftValueSortedMap is broken, can generate NPEs
 
   IMPROVEMENTS
    HBASE-1760  Cleanup TODOs in HTable

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java?rev=985383&r1=985382&r2=985383&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java Fri Aug
13 22:09:42 2010
@@ -20,6 +20,7 @@
 package org.apache.hadoop.hbase.util;
 
 import java.lang.ref.ReferenceQueue;
+import java.lang.ref.SoftReference;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Comparator;
@@ -72,7 +73,7 @@ public class SoftValueSortedMap<K,V> imp
     for (Object obj; (obj = this.rq.poll()) != null;) {
       i++;
       //noinspection unchecked
-      this.internalMap.remove(((SoftValue<K,V>)obj).getKey());
+      this.internalMap.remove(((SoftValue<K,V>)obj).key);
     }
     return i;
   }
@@ -171,13 +172,7 @@ public class SoftValueSortedMap<K,V> imp
   }
 
   public synchronized Set<Map.Entry<K,V>> entrySet() {
-    checkReferences();
-    Set<Map.Entry<K, SoftValue<K,V>>> entries = this.internalMap.entrySet();
-    Set<Map.Entry<K, V>> real_entries = new TreeSet<Map.Entry<K,V>>();
-    for(Map.Entry<K, SoftValue<K,V>> entry : entries) {
-      real_entries.add(entry.getValue());
-    }
-    return real_entries;
+    throw new RuntimeException("Not implemented");
   }
 
   public synchronized Collection<V> values() {
@@ -189,4 +184,13 @@ public class SoftValueSortedMap<K,V> imp
     }
     return hardValues;
   }
+
+  private static class SoftValue<K,V> extends SoftReference<V> {
+    final K key;
+
+    SoftValue(K key, V value, ReferenceQueue q) {
+      super(value, q);
+      this.key = key;
+    }
+  }
 }



Mime
View raw message