Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

tried to fix 100% CPU when calling Balancer.top() see also: http://forum.yacy-websuche.de/viewtopic.php?p=19978#p19978

orbiter40a8d132d9df
diff --git a/source/de/anomic/crawler/Balancer.java b/source/de/anomic/crawler/Balancer.java
index c01c18ba8..a373c6375 100644
--- a/source/de/anomic/crawler/Balancer.java
+++ b/source/de/anomic/crawler/Balancer.java
@@ -507,8 +507,10 @@ public class Balancer {
count = Math.min(count, top.size());
final ArrayList<Request> cel = new ArrayList<Request>();
if (count == 0) return cel;
+ byte[][] ta = new byte[count][];
+ ta = top.toArray(ta);
synchronized (this) {
- for (byte[] n: top) {
+ for (byte[] n: ta) {
try {
final Row.Entry rowEntry = urlFileIndex.get(n);
if (rowEntry == null) continue;