Author: toad
Date: 2008-06-20 22:25:23 +0000 (Fri, 20 Jun 2008)
New Revision: 20538

Modified:
   branches/db4o/freenet/src/freenet/support/SectoredRandomGrabArray.java
Log:
Try to prevent long pauses activating tons of stuff at once, by setting the 
activation depth to 3 on the grabArraysByClient hashmap. We might be able to 
get away with less than 3 even...

Modified: branches/db4o/freenet/src/freenet/support/SectoredRandomGrabArray.java
===================================================================
--- branches/db4o/freenet/src/freenet/support/SectoredRandomGrabArray.java      
2008-06-20 20:56:54 UTC (rev 20537)
+++ branches/db4o/freenet/src/freenet/support/SectoredRandomGrabArray.java      
2008-06-20 22:25:23 UTC (rev 20538)
@@ -4,6 +4,7 @@
 import java.util.Map;

 import com.db4o.ObjectContainer;
+import com.db4o.types.Db4oMap;

 import freenet.client.async.ClientContext;
 import freenet.crypt.RandomSource;
@@ -22,10 +23,11 @@
        public SectoredRandomGrabArray(RandomSource rand, boolean persistent, 
ObjectContainer container) {
                this.rand = rand;
                this.persistent = persistent;
-               if(persistent)
+               if(persistent) {
                        // FIXME is this too heavyweight? Maybe we should 
iterate the array or something?
                        grabArraysByClient = 
container.ext().collections().newHashMap(10);
-               else
+                       ((Db4oMap)grabArraysByClient).activationDepth(3);
+               } else
                        grabArraysByClient = new HashMap();
                grabArrays = new RemoveRandomWithObject[0];
        }


Reply via email to