Author: toad
Date: 2008-06-28 20:50:53 +0000 (Sat, 28 Jun 2008)
New Revision: 20860

Modified:
   branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
   
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
Log:
Logging

Modified: 
branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java  
2008-06-28 20:43:09 UTC (rev 20859)
+++ branches/db4o/freenet/src/freenet/client/async/ClientRequestScheduler.java  
2008-06-28 20:50:53 UTC (rev 20860)
@@ -430,7 +430,7 @@
                return schedCore.removeFirst(fuzz, random, offeredKeys, 
starter, schedTransient, true, false, prio, retryCount, clientContext, null);
        }

-       private static final int MAX_STARTER_QUEUE_SIZE = 100;
+       static final int MAX_STARTER_QUEUE_SIZE = 100;

        /**
         * Normally this will only contain PersistentChosenRequest's, however 
in the
@@ -452,6 +452,12 @@
                }
        }

+       int starterQueueSize() {
+               synchronized(starterQueue) {
+                       return starterQueue.size();
+               }
+       }
+       
        private DBJob requestStarterQueueFiller = new DBJob() {
                public void run(ObjectContainer container, ClientContext 
context) {
                        if(isInsertScheduler && !isSSKScheduler) {

Modified: 
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java
===================================================================
--- 
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java  
    2008-06-28 20:43:09 UTC (rev 20859)
+++ 
branches/db4o/freenet/src/freenet/client/async/ClientRequestSchedulerCore.java  
    2008-06-28 20:50:53 UTC (rev 20860)
@@ -171,7 +171,9 @@
                                return true;
                        }
                });
+               int count = 0;
                while(results.hasNext()) {
+                       count++;
                        PersistentChosenRequest req = (PersistentChosenRequest) 
results.next();
                        container.activate(req, 2);
                        container.activate(req.key, 5);
@@ -191,6 +193,10 @@
                        }
                        sched.addToStarterQueue(req);
                }
+               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());
        }

        // We pass in the schedTransient to the next two methods so that we can 
select between either of them.


Reply via email to