fix for fixes from this afternoon

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6253 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent cf739edc2e
commit 8e56c2ace6

@ -109,7 +109,7 @@ public final class LoaderDispatcher {
final yacyURL url, final yacyURL url,
final boolean forText, final boolean forText,
final boolean global final boolean global
) throws IOException { ) {
return new Request( return new Request(
sb.peers.mySeed().hash, sb.peers.mySeed().hash,
url, url,

@ -135,14 +135,16 @@ public class MapView {
* @throws IOException * @throws IOException
*/ */
public void put(String key, final Map<String, String> newMap) throws IOException { public void put(String key, final Map<String, String> newMap) throws IOException {
assert (key != null); assert key != null;
assert (key.length() > 0); assert key.length() > 0;
assert (newMap != null); assert newMap != null;
key = normalizeKey(key); key = normalizeKey(key);
assert blob != null;
synchronized (this) { synchronized (this) {
// write entry // write entry
blob.put(key.getBytes("UTF-8"), map2string(newMap, "W" + DateFormatter.formatShortSecond() + " ").getBytes("UTF-8")); String s = map2string(newMap, "W" + DateFormatter.formatShortSecond() + " ");
assert s != null;
blob.put(key.getBytes("UTF-8"), s.getBytes("UTF-8"));
// write map to cache // write map to cache
cache.put(key, newMap); cache.put(key, newMap);

@ -62,16 +62,18 @@ public class SimpleARC <K, V> {
} }
/** /**
* put a value to the cache. The value may NOT exist before. * put a value to the cache.
* This restriction is used here to check possible algorithm logic error cases.
* @param s * @param s
* @param v * @param v
*/ */
public void put(K s, V v) { public void put(K s, V v) {
assert this.levelA.get(s) == null; if (this.levelB.containsKey(s)) {
assert this.levelB.get(s) == null; this.levelB.put(s, v);
this.levelA.put(s, v); assert (this.levelB.size() <= cacheSize); // the cache should shrink automatically
assert (this.levelA.size() <= cacheSize); // the cache should shrink automatically } else {
this.levelA.put(s, v);
assert (this.levelA.size() <= cacheSize); // the cache should shrink automatically
}
} }
/** /**

Loading…
Cancel
Save