forked from I2P_Developers/i2p.i2p
Blockfile: Add generics, part 4
This commit is contained in:
@ -540,7 +540,7 @@ public class BlockfileNamingService extends DummyNamingService {
|
|||||||
* @return removed object or null
|
* @return removed object or null
|
||||||
* @throws RuntimeException
|
* @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);
|
return sl.remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -858,12 +858,12 @@ public class BlockfileNamingService extends DummyNamingService {
|
|||||||
SkipList<String, DestEntry> sl = _bf.getIndex(listname, _stringSerializer, _destSerializer);
|
SkipList<String, DestEntry> sl = _bf.getIndex(listname, _stringSerializer, _destSerializer);
|
||||||
if (sl == null)
|
if (sl == null)
|
||||||
return false;
|
return false;
|
||||||
Object removed = removeEntry(sl, key);
|
DestEntry removed = removeEntry(sl, key);
|
||||||
boolean rv = removed != null;
|
boolean rv = removed != null;
|
||||||
if (rv) {
|
if (rv) {
|
||||||
removeCache(hostname);
|
removeCache(hostname);
|
||||||
try {
|
try {
|
||||||
removeReverseEntry(key, ((DestEntry)removed).dest);
|
removeReverseEntry(key, removed.dest);
|
||||||
} catch (ClassCastException cce) {
|
} catch (ClassCastException cce) {
|
||||||
_log.error("DB reverse remove error", cce);
|
_log.error("DB reverse remove error", cce);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ public class SkipList<K extends Comparable<? super K>, V> implements Flushable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Object remove(K key) {
|
public V remove(K key) {
|
||||||
if(key == null) { throw new NullPointerException(); }
|
if(key == null) { throw new NullPointerException(); }
|
||||||
Object[] res = stack.remove(stack.levels.length - 1, key, this);
|
Object[] res = stack.remove(stack.levels.length - 1, key, this);
|
||||||
if(res != null) {
|
if(res != null) {
|
||||||
@ -132,7 +132,7 @@ public class SkipList<K extends Comparable<? super K>, V> implements Flushable {
|
|||||||
stack.flush();
|
stack.flush();
|
||||||
}
|
}
|
||||||
flush();
|
flush();
|
||||||
return res[0];
|
return (V) res[0];
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user