Author: toad
Date: 2009-01-24 22:20:48 +0000 (Sat, 24 Jan 2009)
New Revision: 25303

Modified:
   branches/db4o/freenet/src/freenet/client/async/SimpleManifestPutter.java
Log:
Run gotAllMetadata() on its own transaction


Modified: 
branches/db4o/freenet/src/freenet/client/async/SimpleManifestPutter.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SimpleManifestPutter.java    
2009-01-24 21:28:27 UTC (rev 25302)
+++ branches/db4o/freenet/src/freenet/client/async/SimpleManifestPutter.java    
2009-01-24 22:20:48 UTC (rev 25303)
@@ -33,6 +33,7 @@
 import freenet.support.Logger;
 import freenet.support.api.Bucket;
 import freenet.support.io.BucketTools;
+import freenet.support.io.NativeThread;
 
 public class SimpleManifestPutter extends BaseClientPutter implements 
PutCompletionCallback {
        // Only implements PutCompletionCallback for the final metadata insert
@@ -453,6 +454,18 @@
        }
 
        private void gotAllMetadata(ObjectContainer container, ClientContext 
context) {
+               // This can be huge! Run it on its own transaction to minimize 
the build up of stuff to commit
+               // and maximise the opportunities for garbage collection.
+               context.jobRunner.queue(new DBJob() {
+
+                       public void run(ObjectContainer container, 
ClientContext context) {
+                               innerGotAllMetadata(container, context);
+                       }
+                       
+               }, NativeThread.NORM_PRIORITY, false);
+       }
+       
+       private void innerGotAllMetadata(ObjectContainer container, 
ClientContext context) {
                if(persistent()) {
                        container.activate(putHandlersByName, 2);
                }

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to