Author: stack Date: Sat Apr 17 02:27:16 2010 New Revision: 935110 URL: http://svn.apache.org/viewvc?rev=935110&view=rev Log: HBASE-2458 Client stuck in TreeMap,remove
Modified: hadoop/hbase/branches/0.20/CHANGES.txt hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java Modified: hadoop/hbase/branches/0.20/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/CHANGES.txt?rev=935110&r1=935109&r2=935110&view=diff ============================================================================== --- hadoop/hbase/branches/0.20/CHANGES.txt (original) +++ hadoop/hbase/branches/0.20/CHANGES.txt Sat Apr 17 02:27:16 2010 @@ -138,6 +138,7 @@ Release 0.20.4 - Unreleased HBASE-1892 [performance] make hbase splits run faster HBASE-2453 Revisit compaction policies after HBASE-2248 commit (Jonathan Gray via Stack) + HBASE-2458 Client stuck in TreeMap,remove (Todd Lipcon via Stack) NEW FEATURES HBASE-2257 [stargate] multiuser mode Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java?rev=935110&r1=935109&r2=935110&view=diff ============================================================================== --- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java (original) +++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java Sat Apr 17 02:27:16 2010 @@ -65,7 +65,7 @@ public class SoftValueSortedMap<K,V> imp * Internally these call checkReferences on each access. * @return How many references cleared. */ - public int checkReferences() { + private int checkReferences() { int i = 0; for (Object obj = null; (obj = this.rq.poll()) != null;) { i++; @@ -74,7 +74,7 @@ public class SoftValueSortedMap<K,V> imp return i; } - public V put(K key, V value) { + public synchronized V put(K key, V value) { checkReferences(); SoftValue<K,V> oldValue = this.internalMap.put(key, new SoftValue<K,V>(key, value, this.rq)); @@ -82,11 +82,11 @@ public class SoftValueSortedMap<K,V> imp } @SuppressWarnings("unchecked") - public void putAll(Map map) { + public synchronized void putAll(Map map) { throw new RuntimeException("Not implemented"); } - public V get(Object key) { + public synchronized V get(Object key) { checkReferences(); SoftValue<K,V> value = this.internalMap.get(key); if (value == null) { @@ -99,74 +99,74 @@ public class SoftValueSortedMap<K,V> imp return value.get(); } - public V remove(Object key) { + public synchronized V remove(Object key) { checkReferences(); SoftValue<K,V> value = this.internalMap.remove(key); return value == null ? null : value.get(); } - public boolean containsKey(Object key) { + public synchronized boolean containsKey(Object key) { checkReferences(); return this.internalMap.containsKey(key); } - public boolean containsValue(Object value) { + public synchronized boolean containsValue(Object value) { /* checkReferences(); return internalMap.containsValue(value);*/ throw new UnsupportedOperationException("Don't support containsValue!"); } - public K firstKey() { + public synchronized K firstKey() { checkReferences(); return internalMap.firstKey(); } - public K lastKey() { + public synchronized K lastKey() { checkReferences(); return internalMap.lastKey(); } - public SoftValueSortedMap<K,V> headMap(K key) { + public synchronized SoftValueSortedMap<K,V> headMap(K key) { checkReferences(); return new SoftValueSortedMap<K,V>(this.internalMap.headMap(key)); } - public SoftValueSortedMap<K,V> tailMap(K key) { + public synchronized SoftValueSortedMap<K,V> tailMap(K key) { checkReferences(); return new SoftValueSortedMap<K,V>(this.internalMap.tailMap(key)); } - public SoftValueSortedMap<K,V> subMap(K fromKey, K toKey) { + public synchronized SoftValueSortedMap<K,V> subMap(K fromKey, K toKey) { checkReferences(); return new SoftValueSortedMap<K,V>(this.internalMap.subMap(fromKey, toKey)); } - public boolean isEmpty() { + public synchronized boolean isEmpty() { checkReferences(); return this.internalMap.isEmpty(); } - public int size() { + public synchronized int size() { checkReferences(); return this.internalMap.size(); } - public void clear() { + public synchronized void clear() { checkReferences(); this.internalMap.clear(); } - public Set<K> keySet() { + public synchronized Set<K> keySet() { checkReferences(); return this.internalMap.keySet(); } @SuppressWarnings("unchecked") - public Comparator comparator() { + public synchronized Comparator comparator() { return this.internalMap.comparator(); } - public Set<Map.Entry<K,V>> entrySet() { + 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>>(); @@ -176,7 +176,7 @@ public class SoftValueSortedMap<K,V> imp return real_entries; } - public Collection<V> values() { + public synchronized Collection<V> values() { checkReferences(); Collection<SoftValue<K,V>> softValues = this.internalMap.values(); ArrayList<V> hardValues = new ArrayList<V>(); @@ -185,4 +185,4 @@ public class SoftValueSortedMap<K,V> imp } return hardValues; } -} \ No newline at end of file +}