HBASE-2458 Client stuck in TreeMap,remove
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@935111 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
57dca6f753
commit
0dcf305575
|
@ -273,6 +273,8 @@ Release 0.21.0 - Unreleased
|
|||
(Kannan Muthukkaruppan via Stack)
|
||||
HBASE-2451 .META. by-passes cache; BLOCKCACHE=>'false'
|
||||
HBASE-2453 Revisit compaction policies after HBASE-2248 commit
|
||||
(Jonathan Gray via Stack)
|
||||
HBASE-2458 Client stuck in TreeMap,remove (Todd Lipcon via Stack)
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-1760 Cleanup TODOs in HTable
|
||||
|
|
|
@ -67,7 +67,7 @@ public class SoftValueSortedMap<K,V> implements SortedMap<K,V> {
|
|||
* Internally these call checkReferences on each access.
|
||||
* @return How many references cleared.
|
||||
*/
|
||||
public int checkReferences() {
|
||||
private int checkReferences() {
|
||||
int i = 0;
|
||||
for (Object obj; (obj = this.rq.poll()) != null;) {
|
||||
i++;
|
||||
|
@ -77,7 +77,7 @@ public class SoftValueSortedMap<K,V> implements SortedMap<K,V> {
|
|||
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));
|
||||
|
@ -85,12 +85,12 @@ public class SoftValueSortedMap<K,V> implements SortedMap<K,V> {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void putAll(Map map) {
|
||||
public synchronized void putAll(Map map) {
|
||||
throw new RuntimeException("Not implemented");
|
||||
}
|
||||
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public V get(Object key) {
|
||||
public synchronized V get(Object key) {
|
||||
checkReferences();
|
||||
SoftValue<K,V> value = this.internalMap.get(key);
|
||||
if (value == null) {
|
||||
|
@ -103,74 +103,74 @@ public class SoftValueSortedMap<K,V> implements SortedMap<K,V> {
|
|||
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>>();
|
||||
|
@ -180,7 +180,7 @@ public class SoftValueSortedMap<K,V> implements SortedMap<K,V> {
|
|||
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>();
|
||||
|
@ -189,4 +189,4 @@ public class SoftValueSortedMap<K,V> implements SortedMap<K,V> {
|
|||
}
|
||||
return hardValues;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue