In DHT selection delete only those references that were actually selected

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5693 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
hermens 2009-03-10 13:56:30 +00:00
parent 60078cf322
commit 8c60d6d117

View File

@ -28,6 +28,7 @@ package de.anomic.yacy.dht;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -188,7 +189,17 @@ public class Dispatcher {
containers.add(container); containers.add(container);
} }
// then remove the container from the backend // then remove the container from the backend
for (ReferenceContainer c: containers) this.backend.deleteAllReferences(c.getWordHash()); HashSet<String> urlHashes = new HashSet<String>();
Iterator<ReferenceRow> it;
for (ReferenceContainer c: containers) {
urlHashes.clear();
it = c.entries();
while (it.hasNext()) {
urlHashes.add(it.next().urlHash());
}
if (this.log.isFine()) this.log.logFine("selected " + urlHashes.size() + " urls for word '" + c.getWordHash() + "'");
if (urlHashes.size() > 0) this.backend.removeReferences(c.getWordHash(), urlHashes);
}
// finished. The caller must take care of the containers and must put them back if not needed // finished. The caller must take care of the containers and must put them back if not needed
return containers; return containers;