Author: jflesch
Date: 2006-06-05 21:28:31 +0000 (Mon, 05 Jun 2006)
New Revision: 9058

Modified:
   trunk/freenet/src/freenet/clients/http/Spider.java
Log:
Little fix on Spider: Synchronized keyword doesn't seem to do its work 
correctly => sometimes (running > maxParallelRequests) => It generated an 
exception

Modified: trunk/freenet/src/freenet/clients/http/Spider.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Spider.java  2006-06-05 11:40:54 UTC 
(rev 9057)
+++ trunk/freenet/src/freenet/clients/http/Spider.java  2006-06-05 21:28:31 UTC 
(rev 9058)
@@ -83,9 +83,12 @@
                        }
                        int running = runningFetchesByURI.size();
                        int queued = queuedURIList.size();
-                       if (running == maxParallelRequests || queued == 0)
+                       
+                       if (running >= maxParallelRequests || queued == 0)
                                return;
+                       
                        toStart = new ArrayList(Math.min(maxParallelRequests - 
running, queued));
+                       
                        for (int i = running; i < maxParallelRequests; i++) {
                                if (queuedURIList.isEmpty())
                                        break;


Reply via email to