Blockfile: Add generics, part 4

This commit is contained in:
zzz
2016-04-20 13:08:42 +00:00
parent 0067c8d1bd
commit 436fee9200
2 changed files with 5 additions and 5 deletions

View File

@ -540,7 +540,7 @@ public class BlockfileNamingService extends DummyNamingService {
* @return removed object or null
* @throws RuntimeException
*/
private static Object removeEntry(SkipList<String, ?> sl, String key) {
private static <V> V removeEntry(SkipList<String, V> sl, String key) {
return sl.remove(key);
}
@ -858,12 +858,12 @@ public class BlockfileNamingService extends DummyNamingService {
SkipList<String, DestEntry> sl = _bf.getIndex(listname, _stringSerializer, _destSerializer);
if (sl == null)
return false;
Object removed = removeEntry(sl, key);
DestEntry removed = removeEntry(sl, key);
boolean rv = removed != null;
if (rv) {
removeCache(hostname);
try {
removeReverseEntry(key, ((DestEntry)removed).dest);
removeReverseEntry(key, removed.dest);
} catch (ClassCastException cce) {
_log.error("DB reverse remove error", cce);
}

View File

@ -118,7 +118,7 @@ public class SkipList<K extends Comparable<? super K>, V> implements Flushable {
}
@SuppressWarnings("unchecked")
public Object remove(K key) {
public V remove(K key) {
if(key == null) { throw new NullPointerException(); }
Object[] res = stack.remove(stack.levels.length - 1, key, this);
if(res != null) {
@ -132,7 +132,7 @@ public class SkipList<K extends Comparable<? super K>, V> implements Flushable {
stack.flush();
}
flush();
return res[0];
return (V) res[0];
}
return null;
}