Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fix for 100% cpu bug during dht selection see also: http://www.yacy-forum.de/viewtopic.php?p=34068#34068
orbiter063063aa0ca0
diff --git a/source/de/anomic/kelondro/kelondroRotateIterator.java b/source/de/anomic/kelondro/kelondroRotateIterator.javaindex eb31f5d46..7e55d50d3 100644--- a/source/de/anomic/kelondro/kelondroRotateIterator.java+++ b/source/de/anomic/kelondro/kelondroRotateIterator.java@@ -47,6 +47,9 @@ public class kelondroRotateIterator implements kelondroCloneableIterator {}public Object next() {+ // attention: this iterator has no termination - on purpose.+ // it must be taken care that a calling method has a termination predicate different+ // from the hasNext() methodif (!(a.hasNext())) {a = (kelondroCloneableIterator) clone.clone(modifier);}diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.javaindex 9a088eb0e..c3d93de8d 100644--- a/source/de/anomic/plasma/plasmaWordIndex.java+++ b/source/de/anomic/plasma/plasmaWordIndex.java@@ -496,14 +496,18 @@ public final class plasmaWordIndex implements indexRI {Iterator i = wordContainers(startHash, ram, rot);if (ram) count = Math.min(dhtOutCache.size(), count);indexContainer container;+ // this loop does not terminate using the i.hasNex() predicate when rot == true+ // because then the underlying iterator is a rotating iterator without termination+ // in this case a termination must be ensured with a counter+ // It must also be ensured that the counter is in/decreased every loopwhile ((count > 0) && (i.hasNext())) {container = (indexContainer) i.next();if ((container != null) && (container.size() > 0)) {containers.add(container);- count--;}+ count--; // decrease counter even if the container was null or empty to ensure termination}- return containers;+ return containers; // this may return less containers as demanded}public kelondroCloneableIterator wordContainers(String startHash, boolean ram, boolean rot) {