Author: toad
Date: 2008-06-19 15:11:46 +0000 (Thu, 19 Jun 2008)
New Revision: 20489
Modified:
branches/db4o/freenet/src/freenet/client/FECQueue.java
Log:
Logging
Modified: branches/db4o/freenet/src/freenet/client/FECQueue.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/FECQueue.java 2008-06-19
15:07:51 UTC (rev 20488)
+++ branches/db4o/freenet/src/freenet/client/FECQueue.java 2008-06-19
15:11:46 UTC (rev 20489)
@@ -153,6 +153,8 @@
databaseJobRunner.queue(new DBJob() {
public void
run(ObjectContainer container, ClientContext context) {
+
if(Logger.shouldLog(Logger.MINOR, this))
+
if(Logger.shouldLog(Logger.MINOR, this))
if(job.isADecodingJob)
job.callback.onDecodedSegment(container, clientContext);
else
@@ -186,6 +188,8 @@
public void run(ObjectContainer container, ClientContext
context) {
// Try to avoid accessing the database while
synchronized on the FECQueue.
+ boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
+ if(logMINOR) Logger.minor(this, "Running FEC cache
filler job");
while(true) {
boolean addedAny = false;
int totalCached = 0;
@@ -196,6 +200,7 @@
if(newCached >=
maxPersistentQueueCacheSize) return;
grab =
maxPersistentQueueCacheSize - newCached;
}
+ if(logMINOR) Logger.minor(this,
"Grabbing up to "+grab+" jobs");
Query query = container.query();
query.constrain(FECJob.class);
query.descend("priority").constrain(new
Short(i));
@@ -205,6 +210,7 @@
if(results.hasNext()) {
for(int j=0;j<grab &&
results.hasNext();j++) {
FECJob job = (FECJob)
results.next();
+ if(logMINOR)
Logger.minor(this, "Maybe adding "+job);
synchronized(FECQueue.this) {
if(persistentQueueCache[j].contains(job)) {
j--;
@@ -227,6 +233,8 @@
}
}
if(!addedAny) {
+ if(logMINOR)
+ Logger.minor(this, "No more
jobs to add");
return;
} else {
int maxRunningThreads =
getMaxRunningFECThreads();