Author: toad
Date: 2008-06-28 20:54:32 +0000 (Sat, 28 Jun 2008)
New Revision: 20861
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
Log:
Logging.
Separate threshold for starter queue size.
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
2008-06-28 20:50:53 UTC (rev 20860)
+++ branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
2008-06-28 20:54:32 UTC (rev 20861)
@@ -430,8 +430,17 @@
return schedCore.removeFirst(fuzz, random, offeredKeys,
starter, schedTransient, true, false, prio, retryCount, clientContext, null);
}
+ /** The maximum number of requests that we will keep on the in-RAM
request
+ * starter queue. */
static final int MAX_STARTER_QUEUE_SIZE = 100;
+ /** The above doesn't include in-flight requests. In-flight requests
will
+ * of course still have PersistentChosenRequest's in the database (on
disk)
+ * even though they are not on the starter queue and so don't count
towards
+ * the above limit. So we have a higher limit before we complain that
+ * something odd is happening.. (e.g. leaking
PersistentChosenRequest's). */
+ static final int WARNING_STARTER_QUEUE_SIZE = 300;
+
/**
* Normally this will only contain PersistentChosenRequest's, however
in the
* case of coalescing keys, we will put ChosenRequest's back onto it as
well.
@@ -466,8 +475,10 @@
if(logMINOR) Logger.minor(this, "Filling request
queue... (SSK="+isSSKScheduler+" insert="+isInsertScheduler);
ChosenRequest req = null;
synchronized(starterQueue) {
- if(starterQueue.size() >=
MAX_STARTER_QUEUE_SIZE) {
- Logger.error(this, "Queue already full:
"+starterQueue.size());
+ int size = starterQueue.size();
+ if(size >= MAX_STARTER_QUEUE_SIZE) {
+ if(size >= WARNING_STARTER_QUEUE_SIZE)
+ Logger.error(this, "Queue
already full: "+starterQueue.size());
return;
}
}
Modified:
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
===================================================================
---
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
2008-06-28 20:50:53 UTC (rev 20860)
+++
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
2008-06-28 20:54:32 UTC (rev 20861)
@@ -193,10 +193,10 @@
}
sched.addToStarterQueue(req);
}
- if(count > ClientRequestScheduler.MAX_STARTER_QUEUE_SIZE)
+// if(count > ClientRequestScheduler.MAX_STARTER_QUEUE_SIZE)
Logger.error(this, "Added "+count+" requests to the
starter queue, size now "+sched.starterQueueSize());
- else
- Logger.normal(this, "Added "+count+" requests to the
starter queue, size now "+sched.starterQueueSize());
+// else
+// Logger.normal(this, "Added "+count+" requests to the
starter queue, size now "+sched.starterQueueSize());
}
// We pass in the schedTransient to the next two methods so that we can
select between either of them.