Author: toad Date: 2008-06-06 12:23:02 +0000 (Fri, 06 Jun 2008) New Revision: 20238
Modified:
branches/db4o/freenet/src/freenet/client/FECQueue.java
Log:
Start FEC threads if necessary in the cacheFillerJob
Modified: branches/db4o/freenet/src/freenet/client/FECQueue.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/FECQueue.java 2008-06-06
12:11:18 UTC (rev 20237)
+++ branches/db4o/freenet/src/freenet/client/FECQueue.java 2008-06-06
12:23:02 UTC (rev 20238)
@@ -223,7 +223,26 @@
}
}
}
- if(!addedAny) return;
+ if(!addedAny) {
+ return;
+ } else {
+ int maxRunningThreads =
getMaxRunningFECThreads();
+ synchronized(FECQueue.this) {
+ if(runningFECThreads <
maxRunningThreads) {
+ int queueSize = 0;
+ for(int
i=0;i<priorities;i++) {
+ queueSize +=
persistentQueueCache[i].size();
+ if(queueSize +
runningFECThreads > maxRunningThreads) break;
+ }
+ if(queueSize +
runningFECThreads < maxRunningThreads)
+
maxRunningThreads = queueSize + runningFECThreads;
+ while(runningFECThreads
< maxRunningThreads) {
+
executor.execute(runner, "FEC Pool "+fecPoolCounter++);
+
runningFECThreads++;
+ }
+ }
+ }
+ }
}
}
